OAI: Strictly type chat completions

Previously, the messages were a list of dicts. These are untyped
and don't provide strict hinting. Add types for chat completion
messages and reformat existing code.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2024-11-19 23:15:47 -05:00
parent 0fadb1e5e8
commit 8ffc636dce
3 changed files with 37 additions and 25 deletions

View File

@@ -132,6 +132,7 @@ async def chat_completion_request(
else:
if model.container.use_vision:
data.messages, embeddings = await preprocess_vision_request(data.messages)
prompt = await format_prompt_with_template(data)
# Set an empty JSON schema if the request wants a JSON response