mirror of
https://github.com/open-webui/pipelines
synced 2025-06-25 17:45:56 +00:00
refac
This commit is contained in:
parent
a7238b96b7
commit
f1bcd5be0f
@ -32,6 +32,7 @@ class Pipeline:
|
|||||||
AZURE_OPENAI_API_KEY = "your-azure-openai-api-key-here"
|
AZURE_OPENAI_API_KEY = "your-azure-openai-api-key-here"
|
||||||
AZURE_OPENAI_ENDPOINT = "your-azure-openai-endpoint-here"
|
AZURE_OPENAI_ENDPOINT = "your-azure-openai-endpoint-here"
|
||||||
DEPLOYMENT_NAME = "your-deployment-name-here"
|
DEPLOYMENT_NAME = "your-deployment-name-here"
|
||||||
|
MODEL = "gpt-3.5-turbo"
|
||||||
|
|
||||||
headers = {"api-key": AZURE_OPENAI_API_KEY, "Content-Type": "application/json"}
|
headers = {"api-key": AZURE_OPENAI_API_KEY, "Content-Type": "application/json"}
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ class Pipeline:
|
|||||||
try:
|
try:
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
url=url,
|
url=url,
|
||||||
json={**body, "model": "gpt-3.5-turbo"},
|
json={**body, "model": MODEL},
|
||||||
headers=headers,
|
headers=headers,
|
||||||
stream=True,
|
stream=True,
|
||||||
)
|
)
|
||||||
|
@ -28,7 +28,9 @@ class Pipeline:
|
|||||||
|
|
||||||
print(messages)
|
print(messages)
|
||||||
print(user_message)
|
print(user_message)
|
||||||
|
|
||||||
OPENAI_API_KEY = "your-openai-api-key-here"
|
OPENAI_API_KEY = "your-openai-api-key-here"
|
||||||
|
MODEL = "gpt-3.5-turbo"
|
||||||
|
|
||||||
headers = {}
|
headers = {}
|
||||||
headers["Authorization"] = f"Bearer {OPENAI_API_KEY}"
|
headers["Authorization"] = f"Bearer {OPENAI_API_KEY}"
|
||||||
@ -37,7 +39,7 @@ class Pipeline:
|
|||||||
try:
|
try:
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
url="https://api.openai.com/v1/chat/completions",
|
url="https://api.openai.com/v1/chat/completions",
|
||||||
json={**body, "model": "gpt-3.5-turbo"},
|
json={**body, "model": MODEL},
|
||||||
headers=headers,
|
headers=headers,
|
||||||
stream=True,
|
stream=True,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user