Support for Azure OpenAI
ghbacct opened this issue · comments
There is a previous issue that seems to have added this functionality, however it's not clear to me how I can use it.
How can I use Doctran with Azure OpenAI models?
I'm facing similar issue , I would like to use doctran with Azure open AI ,
I've got access to following environment variables :
OPENAI_EMBEDDING_API_KEY
OPENAI_CHAT_API_KEY
OPENAI_CHAT_MODEL_NAMES
OPENAI_CHAT_API_BASE_URL
OPENAI_EMBEDDING_API_BASE_URL
OPENAI_EMBEDDING_VERSION
OPENAI_CHAT_VERSION
but not sure how to use them with doctran
I was able to use doctran for azure with this code
from doctran import Doctran
import os
# This is the Azure OpenAI Endpoint
os.environ["OPENAI_API_BASE"] = "https://{YOUR_RESOURCE_NAME}.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = <API_VERSION>
doctran = Doctran(
openai_api_key=<AZURE_OPENAI_API_KEY>,
openai_deployment_id=<AZURE_OPENAI_DEPLOYMENT_ID>,
)
document = doctran.parse(
content="",
content_type="text"
)
@aroffe99
Thanks for your inputs. I tied out your code with few modification.
os.environ["OPENAI_API_BASE"] = OPENAI_CHAT_API_BASE_URL
os.environ["OPENAI_API_VERSION"] = OPENAI_CHAT_VERSION
os.environ["OPENAI_API_TYPE"] = "azure"
doctran = Doctran(
openai_api_key=OPENAI_CHAT_API_KEY,
openai_deployment_id=DEPLOYMENT_ID
)
document = doctran.parse(
content=STRING_CONTENT,
content_type="text"
)
but when I call interrogate :
interrogate_doc = await document.interrogate().execute()
I get error ::
Exception: Error executing transformation (<Transformation.interrogate: 'DocumentInterrogator'>, {}): OpenAI function call failed: Unrecognized request argument supplied: functions
Not enough information for me to go further , did you face such error ?
please ignore my earlier comment , I had a problem with my version which was using older chat-completion api