Azure Openai support in tool config
Hello, I am trying out the PDFSearchTool with Azure OpenAI. I see provider = azure_openai is a valid option but I am unable to get it working.
This is my current code:
mytool = PDFSearchTool(
pdf="abcd.pdf",
config=dict(
llm=dict(
provider="azure_openai", # or google, openai, anthropic, llama2, ...
config=dict(
model="gpt4",
azure_deployment=os.getenv("AZURE_OPENAI_DEPLOYMENT"),
api_key=os.getenv("AZURE_OPENAI_KEY"),
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
# top_p=1,
# stream=true,
),
),
embedder=dict(
provider="azure_openai",
config=dict(
model="text-embedding-ada-002",
deployment_name="text-embedding-ada-002",
# title="Embeddings",
),
),
),
)
Getting error:
schema.SchemaError: Key 'llm' error:
Key 'config' error:
Wrong keys 'azure_deployment', 'azure_endpoint' in {... ... }
Any kind of help will be much appreciated.
I am also having this issue, and have not yet found a resolution.
I believe it is now working correctly for me. I had to do 2 things.
- Find the correct key names to use. I have model, deployment_name, and api_key set here from my environment variables.
tool = PDFSearchTool( pdf='file.pdf', config=dict( llm=dict( provider="azure_openai", # or google, openai, anthropic, llama2, ... config=dict( model=os.environ.get("MODEL"), deployment_name=os.environ.get("DEPLOYMENT_NAME"), api_key=os.environ.get("AZURE_OPENAI_KEY"), ), ), embedder=dict( provider="azure_openai", # or openai, ollama, ... config=dict( model="text-embedding-ada-002", deployment_name="text-embedding-ada-002", api_key=os.environ.get("AZURE_OPENAI_KEY"), ), ), ) )
- I believe there may be an issue in the embed chain package that CrewAI uses. In the embedchain/embedder/openai.py file in that package Line 23 I updated to pass in the api_key and api_base
embeddings = AzureOpenAIEmbeddings(deployment=self.config.deployment_name, api_key=api_key, base_url=api_base)
This solution executes (the parameters are accepted) but it's not constructing a RAG DB for me. Weirdly, when I use the code with openAI (not AzureopenAI) it creates the Chroma DB as normal. Then, if I use my code as @DavidGayda outlines above with AzureOpenAI it adds the new text to that existing DB.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Hello, following up on this issue. Is there a fix available for using PDFSearchTool and Azure OpenAI?
Same question, anyone figure out this?
Same question, anyone figure out this?
https://github.com/crewAIInc/crewAI/issues/541#issuecomment-2118393378