Skip to content

Commit 3a6076c

Browse files
committed
fix type and add mypy to tests
1 parent 5c17e9a commit 3a6076c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/workflows/app-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,7 @@ jobs:
7070
cd ./src/frontend
7171
npm install
7272
npm run build
73+
- name: Run MyPy
74+
run: python3 -m mypy .
7375
- name: Run Pytest
7476
run: python3 -m pytest

src/fastapi_app/api_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Any
22

3+
from openai.types.chat import ChatCompletionMessageParam
34
from pydantic import BaseModel
45

56

@@ -9,7 +10,7 @@ class Message(BaseModel):
910

1011

1112
class ChatRequest(BaseModel):
12-
messages: list[Message]
13+
messages: list[ChatCompletionMessageParam]
1314
context: dict = {}
1415

1516

src/fastapi_app/routes/api_routes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ async def chat_handler(
7070
openai_chat: ChatClient,
7171
chat_request: ChatRequest,
7272
):
73-
messages = [message.model_dump() for message in chat_request.messages]
7473
overrides = chat_request.context.get("overrides", {})
7574

7675
searcher = PostgresSearcher(
@@ -95,5 +94,5 @@ async def chat_handler(
9594
chat_deployment=context.openai_chat_deployment,
9695
).run
9796

98-
response = await run_ragchat(messages, overrides=overrides)
97+
response = await run_ragchat(chat_request.messages, overrides=overrides)
9998
return response

0 commit comments

Comments
 (0)