Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft diff #773

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions python/src/aiconfig/default_parsers/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ async def deserialize(self, prompt: Prompt, aiconfig: "AIConfigRuntime", params:
model_settings = self.get_model_settings(prompt, aiconfig)

completion_params = refine_chat_completion_params(model_settings)
add_model_name_to_completion_params_if_not_present(completion_params, prompt, aiconfig)

# In the case thhat the messages array weren't saves as part of the model settings, build it here. Messages array is used for conversation history.
if not completion_params.get("messages"):
Expand Down Expand Up @@ -574,3 +575,12 @@ def build_output_data(
value=tool_calls,
)
return output_data

def add_model_name_to_completion_params_if_not_present(completion_params: dict, prompt: Prompt, aiconfig: "AIConfigRuntime"):
"""
If the completion params do not have a model name, then add it. The model name being used is the one specified in the prompt's metadata.

"""
if completion_params.get("model") is None:
model_name = aiconfig.get_model_name(prompt)
completion_params["model"] = model_name