Azure-Samples / Azure-Samples/openai
AttributeError: 'AzureOpenAI' object has no attribute 'bind'
- Dominant language
- Jupyter Notebook
- Stars
- 1.3k
- Forks
- 455
- Avg merge
- 16h 17m
- Merged PRs (30d)
- 1
Description
This issue is for agentic approach where I am getting error "AzureOpenAI" object has no attribute 'bind'
Codes are as follows:
llm = AzureOpenAI(api_key=openai_api_key,
api_version="xxxx-xx-xx-preview",
azure_endpoint="https://xxxx-xxxxxxx.xxxxxx.xxxxx.com/")
# load crewai tools
serper_search_tool = SerperDevTool()
# load custom tools
kaggle_tool = KaggleDatasetDownloader()
data_collection_agent = Agent(
role='Data Acquisition Specialist',
goal='Find and download appropriate datasets on a given topic',
backstory='Expert in acquiring datasets from various sources, specializing in climate data',
tools=[serper_search_tool, kaggle_tool],
llm=llm,
verbose=True
)
vesrions:
crewai = 0.55.2
langchain = 0.2.16
python = 3.10
Error is as follows:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[15], [line 8](vscode-notebook-cell:?execution_count=15&line=8)
[4](vscode-notebook-cell:?execution_count=15&line=4) # load custom tools
[5](vscode-notebook-cell:?execution_count=15&line=5) kaggle_tool = KaggleDatasetDownloader()
----> [8](vscode-notebook-cell:?execution_count=15&line=8) data_collection_agent = Agent(
[9](vscode-notebook-cell:?execution_count=15&line=9) role='Data Acquisition Specialist',
[10](vscode-notebook-cell:?execution_count=15&line=10) goal='Find and download appropriate datasets on a given topic',
[11](vscode-notebook-cell:?execution_count=15&line=11) backstory='Expert in acquiring datasets from various sources, specializing in climate data',
[12](vscode-notebook-cell:?execution_count=15&line=12) tools=[serper_search_tool, kaggle_tool],
[13](vscode-notebook-cell:?execution_count=15&line=13) llm=llm,
[14](vscode-notebook-cell:?execution_count=15&line=14) verbose=True
[15](vscode-notebook-cell:?execution_count=15&line=15) )
[... skipping hidden 1 frame]
File c:\Users\10742161\AppData\Local\anaconda3\envs\crewai\lib\site-packages\crewai\agent.py:129, in Agent.post_init_setup(self)
[126](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:126) self._setup_llm_callbacks(model_name)
[128](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:128) if not self.agent_executor:
--> [129](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:129) self._setup_agent_executor()
[131](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:131) return self
File c:\Users\10742161\AppData\Local\anaconda3\envs\crewai\lib\site-packages\crewai\agent.py:154, in Agent._setup_agent_executor(self)
[152](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:152) if not self.cache_handler:
[153](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:153) self.cache_handler = CacheHandler()
--> [154](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:154) self.set_cache_handler(self.cache_handler)
File c:\Users\10742161\AppData\Local\anaconda3\envs\crewai\lib\site-packages\crewai\agents\agent_builder\base_agent.py:259, in BaseAgent.set_cache_handler(self, cache_handler)
[257](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agents/agent_builder/base_agent.py:257) self.cache_handler = cache_handler
[258](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agents/agent_builder/base_agent.py:258) self.tools_handler.cache = cache_handler
--> [259](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agents/agent_builder/base_agent.py:259) self.create_agent_executor()
File c:\Users\10742161\AppData\Local\anaconda3\envs\crewai\lib\site-packages\crewai\agent.py:308, in Agent.create_agent_executor(self, tools)
[303](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:303) if self.response_template:
[304](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:304) stop_words.append(
[305](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:305) self.response_template.split("{{ .Response }}")[1].strip()
[306](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:306) )
--> [308](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:308) bind = self.llm.bind(stop=stop_words)
[310](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:310) inner_agent = agent_args | execution_prompt | bind | CrewAgentParser(agent=self)
[311](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:311) self.agent_executor = CrewAgentExecutor(
[312](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:312) agent=RunnableAgent(runnable=inner_agent), **executor_args
[313](file:///C:/Users/10742161/AppData/Local/anaconda3/envs/crewai/lib/site-packages/crewai/agent.py:313) )
AttributeError: 'AzureOpenAI' object has no attribute 'bind'
Contributor guide
Assessment
This issue has not been assessed yet.