mirror of
https://github.com/open-webui/pipelines
synced 2025-05-10 23:50:45 +00:00
fix: initialize request object, correct typo, and rename parameter
- Initialize `r` to `None` to prevent potential `NameError`. - Correct typo: change "funcions" to "functions" in allowed parameters. - Rename "dataSources" to "data_sources" to align with API specs.
This commit is contained in:
parent
68ded857a7
commit
0303263197
@ -56,8 +56,8 @@ class Pipeline:
|
||||
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):
|
||||
@ -67,6 +67,8 @@ class Pipeline:
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user