Skip to content

Commit

Permalink
Merge pull request #245 from kmishmael/main
Browse files Browse the repository at this point in the history
Fix: Initialize request object, correct typo, and rename parameter in Azure OpenAI Pipe
  • Loading branch information
justinh-rahb authored Sep 3, 2024
2 parents 68ded85 + 0303263 commit 6c98edb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/pipelines/providers/azure_openai_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def pipe(
url = f"{self.valves.AZURE_OPENAI_ENDPOINT}/openai/deployments/{self.valves.AZURE_OPENAI_DEPLOYMENT_NAME}/chat/completions?api-version={self.valves.AZURE_OPENAI_API_VERSION}"

allowed_params = {'messages', 'temperature', 'role', 'content', 'contentPart', 'contentPartImage',
'enhancements', 'dataSources', 'n', 'stream', 'stop', 'max_tokens', 'presence_penalty',
'frequency_penalty', 'logit_bias', 'user', 'function_call', 'funcions', 'tools',
'enhancements', 'data_sources', 'n', 'stream', 'stop', 'max_tokens', 'presence_penalty',
'frequency_penalty', 'logit_bias', 'user', 'function_call', 'functions', 'tools',
'tool_choice', 'top_p', 'log_probs', 'top_logprobs', 'response_format', 'seed'}
# remap user field
if "user" in body and not isinstance(body["user"], str):
Expand All @@ -67,6 +67,8 @@ def pipe(
if len(body) != len(filtered_body):
print(f"Dropped params: {', '.join(set(body.keys()) - set(filtered_body.keys()))}")

# Initialize the response variable to None.
r = None
try:
r = requests.post(
url=url,
Expand Down

0 comments on commit 6c98edb

Please sign in to comment.