Skip to content

Commit 062cd9d

Browse files
fix(tutor): creates summariy in the required language (#104)
1 parent bce252f commit 062cd9d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/app/api/api_v1/endpoints/tutor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ async def extract_files_content(
5858
files: Annotated[list[UploadFile], File()],
5959
response: Response,
6060
chatfactory=Depends(get_chat_service),
61+
lang: str = "en",
6162
) -> ExtractorOutputList | None:
6263
files_content = await get_files_content(files)
6364
files_content_str = ("__DOCUMENT_SEPARATOR__").join(files_content)
6465

6566
messages = [
6667
{
6768
"role": "system",
68-
"content": extractor_system_prompt,
69+
"content": extractor_system_prompt + lang,
6970
},
7071
{
7172
"role": "user",

src/app/services/tutor/prompts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
backstory="You are specialised in analysing documents, summarizing them and extracting the main themes. You value precision and clarity.",
44
goal="Analyse each document, summarize it and extract the main themes, explaining why each theme was identified.",
55
expected_output="You must follow the following JSON schema: {extracts: [{'original_document': 'Document', 'summary': 'Summary', 'themes': [{'theme': 'Theme 1', 'reason': 'Reason for Theme 1'}, {'theme': 'Theme 2', 'reason': 'Reason for Theme 2'}, ...]}, {'original_document': 'Document', 'summary': 'Sumamry', 'themes': [{'theme': 'Theme 1', 'reason': 'Reason for Theme 1'}, {'theme': 'Theme 2', 'reason': 'Reason for Theme 2'}, ...]}] } an entry by document make sure to use double quotes when formating the JSON",
6+
The extracts must be written in lang:
67
"""
78

89
extractor_user_prompt = """

0 commit comments

Comments
 (0)