|
19 | 19 | ) |
20 | 20 |
|
21 | 21 | from app import settings |
| 22 | +from app.const import MISSING |
22 | 23 | from app.logging_config import get_logger, setup_logging |
23 | 24 | from app.stackademy import stackademy_app |
24 | 25 |
|
25 | 26 |
|
26 | 27 | setup_logging() |
27 | 28 | logger = get_logger(__name__) |
28 | 29 |
|
29 | | - |
30 | | -messages: list[ |
| 30 | +MessagesType = list[ |
31 | 31 | Union[ |
32 | 32 | ChatCompletionSystemMessageParam, |
33 | 33 | ChatCompletionUserMessageParam, |
34 | 34 | ChatCompletionAssistantMessageParam, |
35 | 35 | ChatCompletionToolMessageParam, |
36 | 36 | ] |
37 | | -] = [ |
| 37 | +] |
| 38 | + |
| 39 | +messages: MessagesType = [ |
38 | 40 | ChatCompletionSystemMessageParam( |
39 | 41 | role="system", |
40 | 42 | content="""You are a helpful assistant for the Stackademy online learning platform. |
@@ -68,9 +70,9 @@ def handle_function_call(function_name: str, arguments: dict) -> str: |
68 | 70 | return json.dumps(courses, default=str, indent=2) |
69 | 71 |
|
70 | 72 | if function_name == "register_course": |
71 | | - course_code = arguments.get("course_code", "MISSING COURSE CODE") |
72 | | - email = arguments.get("email", "MISSING EMAIL") |
73 | | - full_name = arguments.get("full_name", "MISSING NAME") |
| 73 | + course_code = arguments.get("course_code", MISSING) |
| 74 | + email = arguments.get("email", MISSING) |
| 75 | + full_name = arguments.get("full_name", MISSING) |
74 | 76 |
|
75 | 77 | # Call the actual function |
76 | 78 | success = stackademy_app.register_course(course_code=course_code, email=email, full_name=full_name) |
@@ -123,7 +125,6 @@ def process_tool_calls(message: ChatCompletionMessage) -> list[str]: |
123 | 125 | return functions_called |
124 | 126 |
|
125 | 127 |
|
126 | | -# pylint: disable=too-many-locals |
127 | 128 | def completion(prompt: str) -> tuple[ChatCompletion, list[str]]: |
128 | 129 | """LLM text completion""" |
129 | 130 |
|
|
0 commit comments