30 lines
1.7 KiB
Python
30 lines
1.7 KiB
Python
from langchain_openai import ChatOpenAI
|
||
from vacancies.main.models import VacancyFeatures
|
||
|
||
|
||
def extract_vacancy_features(content: str) -> VacancyFeatures:
|
||
"""Extract features from vacancy content using structured output."""
|
||
|
||
prompt = f"""
|
||
Extract the following features from the job vacancy description. If a feature is not mentioned, set it to null.
|
||
Features:
|
||
- employment_type: Тип занятости (e.g., Полная занятость, Частичная)
|
||
- work_format: Формат работы (e.g., Офис, Удалённо, Гибрид)
|
||
- experience: Опыт работы (e.g., 3-5 лет, Нет опыта)
|
||
- position_level: Уровень позиции (e.g., Junior, Senior)
|
||
- industry: Отрасль / Сфера деятельности (e.g., IT, Финансы)
|
||
- tech_stack: Технологический стек / Ключевые навыки (list of strings)
|
||
- location: География (e.g., Москва, Россия)
|
||
- salary_range: Зарплатные ожидания / вилка (e.g., 100000-200000 руб)
|
||
- languages: Языки (list of strings, e.g., ["Русский", "Английский"])
|
||
- education: Образование (e.g., Высшее, Среднее специальное)
|
||
- schedule: График работы (e.g., Полный день, Сменный)
|
||
- additional_requirements: Дополнительные предпочтения / требования (list of strings)
|
||
Vacancy content:
|
||
{content}
|
||
"""
|
||
openai_client = ChatOpenAI(model_name="gpt-5-mini", reasoning_effort="minimal")
|
||
structured_llm = openai_client.with_structured_output(VacancyFeatures)
|
||
response = structured_llm.invoke(prompt)
|
||
return response
|