fix add resume

This commit is contained in:
ivankirpichnikov
2025-11-23 04:53:34 +03:00
parent 2e6214a5ec
commit 9060d23cba
3 changed files with 7 additions and 6 deletions
@@ -22,7 +22,7 @@ class DefaultResumePredictionGenerator(ResumePredictionGenerator):
key_skills=resume.key_skills, key_skills=resume.key_skills,
suituble_vacancies=[ suituble_vacancies=[
SuitableVacancyDs( SuitableVacancyDs(
vacancy_id=suituble_vacancy.vacancy.id, vacancy_id=str(suituble_vacancy.vacancy.id),
from_salary=suituble_vacancy.vacancy.from_salary, from_salary=suituble_vacancy.vacancy.from_salary,
to_salary=suituble_vacancy.vacancy.to_salary, to_salary=suituble_vacancy.vacancy.to_salary,
key_skills=suituble_vacancy.vacancy.key_skills, key_skills=suituble_vacancy.vacancy.key_skills,
@@ -29,7 +29,7 @@ class MlApiGateway:
self._client = client self._client = client
async def generate_embedding(self, text: str) -> list[float]: async def generate_embedding(self, text: str) -> list[float]:
response = await self._client.post("/get_embedding", json={"text": text}) response = await self._client.post("/get_embedding", json={"text": text}, timeout=100)
return cast(list[float], response.json()["embedding"]) return cast(list[float], response.json()["embedding"])
async def generate_resume_prediction( async def generate_resume_prediction(
@@ -39,9 +39,9 @@ class MlApiGateway:
suituble_vacancies: Sequence[SuitableVacancyDs], suituble_vacancies: Sequence[SuitableVacancyDs],
) -> GenerateResumePredictionResponse: ) -> GenerateResumePredictionResponse:
response = await self._client.post( response = await self._client.post(
"/predict_salary", "/predict",
json={ json={
"resume_id": resume_id, "resume_id": str(resume_id),
"key_skills": key_skills, "key_skills": key_skills,
"vacancies": [ "vacancies": [
{ {
@@ -53,6 +53,7 @@ class MlApiGateway:
} for suituble_vacancy in suituble_vacancies } for suituble_vacancy in suituble_vacancies
], ],
}, },
timeout=100,
) )
response_json = response.json() response_json = response.json()
+2 -2
View File
@@ -40,9 +40,9 @@ class VacancyInputModel(BaseModel):
class PredictSalaryRequestModel(BaseModel): class PredictSalaryRequestModel(BaseModel):
resume_id: ResumeId = Field(description="Resume ID", examples=["01234567-89ab-cdef-0123-456789abcdef"]) resume_id: ResumeId = Field(description="Resume ID", examples=["01234567-89ab-cdef-0123-456789abcdef"])
key_skills: list[str] = Field( key_skills: list[str] = Field(
min_length=1, description="List of key skills from resume", examples=[["Python", "FastAPI", "PostgreSQL"]] description="List of key skills from resume", examples=[["Python", "FastAPI", "PostgreSQL"]]
) )
vacancies: list[VacancyInputModel] = Field(min_length=1, description="List of relevant vacancies", examples=[[]]) vacancies: list[VacancyInputModel] = Field(description="List of relevant vacancies", examples=[[]])
model_config = { model_config = {
"json_schema_extra": { "json_schema_extra": {