Compare commits
2 Commits
08d6cddb67
...
5286b2cdc7
| Author | SHA1 | Date | |
|---|---|---|---|
| 5286b2cdc7 | |||
| cd1bb90167 |
@ -15,7 +15,8 @@ WHERE timestamp >= now() - INTERVAL 30 DAY
|
|||||||
'требования', 'обязанности', 'условия', 'компания', 'офис',
|
'требования', 'обязанности', 'условия', 'компания', 'офис',
|
||||||
'удаленно', 'гибкий график', 'полный день', 'частичная занятость',
|
'удаленно', 'гибкий график', 'полный день', 'частичная занятость',
|
||||||
'резюме', 'собеседование', 'junior', 'middle', 'senior'
|
'резюме', 'собеседование', 'junior', 'middle', 'senior'
|
||||||
]) >= 5 AND position(message, 'О себе') = 0 AND position(message, 'Обо мне') = 0 AND position(message, '#ищу') = 0
|
]) >= 5 AND position(message, 'О себе') = 0 AND position(message, 'Обо мне') = 0
|
||||||
|
AND position(message, '#ищу') = 0 AND position(message, 'умею') = 0
|
||||||
AND id NOT IN %(exist_points)s
|
AND id NOT IN %(exist_points)s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@ -106,15 +106,15 @@ def add_vectors(collection_name: str, _id: int, features: dict, payload: dict):
|
|||||||
|
|
||||||
|
|
||||||
def search_similarities(query_filter: Filter, cv_id: int):
|
def search_similarities(query_filter: Filter, cv_id: int):
|
||||||
vectors = client.retrieve(
|
cv = client.retrieve(
|
||||||
collection_name="cvs",
|
collection_name="cvs",
|
||||||
ids=[cv_id],
|
ids=[cv_id],
|
||||||
with_vectors=True,
|
with_vectors=True,
|
||||||
)[0].vector
|
)[0]
|
||||||
|
|
||||||
max_similarities = {}
|
max_similarities = {}
|
||||||
vacancies_content = {}
|
vacancies_content = {}
|
||||||
for name, vec in vectors.items():
|
for name, vec in cv.vector.items():
|
||||||
if any(v != 0 for v in vec):
|
if any(v != 0 for v in vec):
|
||||||
results = client.query_points(
|
results = client.query_points(
|
||||||
collection_name="vacancies",
|
collection_name="vacancies",
|
||||||
@ -140,11 +140,15 @@ def search_similarities(query_filter: Filter, cv_id: int):
|
|||||||
total = sum(feature_sims[feature] * weights.get(feature, 1) for feature in feature_sims)
|
total = sum(feature_sims[feature] * weights.get(feature, 1) for feature in feature_sims)
|
||||||
scored.append({"id": vid, "score": total, "content": vacancies_content[vid]["content"], "link": vacancies_content[vid]["link"]})
|
scored.append({"id": vid, "score": total, "content": vacancies_content[vid]["content"], "link": vacancies_content[vid]["link"]})
|
||||||
|
|
||||||
|
scored.sort(key=lambda x: x["score"], reverse=True)
|
||||||
|
|
||||||
prompt = f"""
|
prompt = f"""
|
||||||
Среди вакансий ниже выбери одну наиболее релевантную и выведи ее индекс.
|
Резюме: {cv.payload['content']}
|
||||||
|
|
||||||
|
Среди вакансий ниже выбери одну наиболее релевантную и выведи ее индекс(от 0 до 9).
|
||||||
Если среди вакансий нет подходящих, то верни -1.
|
Если среди вакансий нет подходящих, то верни -1.
|
||||||
В ответе выведи только число.
|
В ответе выведи только число.
|
||||||
{scored}
|
{scored[:10]}
|
||||||
"""
|
"""
|
||||||
openai_client = ChatOpenAI(model_name="gpt-5-mini", reasoning_effort="minimal", temperature=0, seed=42, top_p=1)
|
openai_client = ChatOpenAI(model_name="gpt-5-mini", reasoning_effort="minimal", temperature=0, seed=42, top_p=1)
|
||||||
response = openai_client.invoke(prompt)
|
response = openai_client.invoke(prompt)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user