I’m looking to integrate Azure OpenAI but need to stick with an older version of the OpenAI library (0.28.1), rather than any version above 1.0.
Currently, I have the following setup using the newer OpenAI library:
import os
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_VERSION"] = "2023-07-01-preview"
os.environ["OPENAI_API_BASE"] = "your-endpoint-here"
os.environ["OPENAI_API_KEY"] = "your-key-here"
from langchain_openai import AzureOpenAI
ai_model = AzureOpenAI(
deployment_name="my-deployment",
model_name="gpt-3.5-turbo-instruct",
)
response = ai_model("Give me a funny story")
Unfortunately, this setup doesn’t function with openai==0.28.1. I’m restricted to this older version due to my project’s specifications. How can I adjust my code to work with the legacy OpenAI library while maintaining the same straightforward usage, like using ai_model("my prompt here")
to receive a response?