From f1bcd5be0f3f6220a5d3ebd504a5cdbeae69c3bc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 21 May 2024 20:12:36 -0700 Subject: [PATCH] refac --- pipelines/examples/azure_openai_pipeline.py | 3 ++- pipelines/examples/openai_pipeline.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pipelines/examples/azure_openai_pipeline.py b/pipelines/examples/azure_openai_pipeline.py index 0e8d77e..0052760 100644 --- a/pipelines/examples/azure_openai_pipeline.py +++ b/pipelines/examples/azure_openai_pipeline.py @@ -32,6 +32,7 @@ class Pipeline: AZURE_OPENAI_API_KEY = "your-azure-openai-api-key-here" AZURE_OPENAI_ENDPOINT = "your-azure-openai-endpoint-here" DEPLOYMENT_NAME = "your-deployment-name-here" + MODEL = "gpt-3.5-turbo" headers = {"api-key": AZURE_OPENAI_API_KEY, "Content-Type": "application/json"} @@ -40,7 +41,7 @@ class Pipeline: try: r = requests.post( url=url, - json={**body, "model": "gpt-3.5-turbo"}, + json={**body, "model": MODEL}, headers=headers, stream=True, ) diff --git a/pipelines/examples/openai_pipeline.py b/pipelines/examples/openai_pipeline.py index 80b8439..1c712e4 100644 --- a/pipelines/examples/openai_pipeline.py +++ b/pipelines/examples/openai_pipeline.py @@ -28,7 +28,9 @@ class Pipeline: print(messages) print(user_message) + OPENAI_API_KEY = "your-openai-api-key-here" + MODEL = "gpt-3.5-turbo" headers = {} headers["Authorization"] = f"Bearer {OPENAI_API_KEY}" @@ -37,7 +39,7 @@ class Pipeline: try: r = requests.post( url="https://api.openai.com/v1/chat/completions", - json={**body, "model": "gpt-3.5-turbo"}, + json={**body, "model": MODEL}, headers=headers, stream=True, )