Unverified Commit 05977bd1 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #4342 from michaelpoluektov/fix-non-streaming-function-text

fix: function returning "str"
parents 8074289a f8ba0334
...@@ -97,18 +97,19 @@ def openai_chat_message_template(model: str): ...@@ -97,18 +97,19 @@ def openai_chat_message_template(model: str):
} }
def openai_chat_chunk_message_template(model: str, message: str): def openai_chat_chunk_message_template(model: str, message: str) -> dict:
template = openai_chat_message_template(model) template = openai_chat_message_template(model)
template["object"] = "chat.completion.chunk" template["object"] = "chat.completion.chunk"
template["choices"][0]["delta"] = {"content": message} template["choices"][0]["delta"] = {"content": message}
return template return template
def openai_chat_completion_message_template(model: str, message: str): def openai_chat_completion_message_template(model: str, message: str) -> dict:
template = openai_chat_message_template(model) template = openai_chat_message_template(model)
template["object"] = "chat.completion" template["object"] = "chat.completion"
template["choices"][0]["message"] = {"content": message, "role": "assistant"} template["choices"][0]["message"] = {"content": message, "role": "assistant"}
template["choices"][0]["finish_reason"] = "stop" template["choices"][0]["finish_reason"] = "stop"
return template
def get_gravatar_url(email): def get_gravatar_url(email):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment