crewAIInc / crewAI-examples

2.63k stars 977 forks source link

Issues running on a Windows Server VM #61

Closed SaldanhaAJ closed 1 week ago

SaldanhaAJ commented 6 months ago

Hello:

Thanks for this product. It has tremendous promise.

While setting it to run on my laptop (Windows 10), I do not run into an issue running it via Ollama.

However on a Windows Server VM it looks like it needs the Open AI key. Here is the error crew = Crew( agents=[researcher, writer], tasks=[task1, task2], llm=ollama_model, verbose=2, # You can set it to 1 or 2 to different logging levels process = Process.sequential )


ValidationError Traceback (most recent call last) Cell In[3], line 19 16 search_tool = DuckDuckGoSearchRun() 18 # Define your agents with roles and goals ---> 19 researcher = Agent( 20 role='Senior Research Analyst', 21 goal='Uncover cutting-edge developments in AI and data science', 22 backstory="""You work at a leading tech think tank. 23 Your expertise lies in identifying emerging trends. 24 You have a knack for dissecting complex data and presenting actionable insights.""", 25 verbose=True, 26 allow_delegation=False, 27 max_iter=2, 28 max_rpm=2, 29 tools=[search_tool] 30 # You can pass an optional llm attribute specifying what mode you wanna use. 31 # It can be a local model through Ollama / LM Studio or a remote 32 # model like OpenAI, Mistral, Antrophic or others (https://python.langchain.com/docs/integrations/llms/) 33 # 34 # Examples: 35 # 36 # from langchain_community.llms import Ollama 37 # llm=ollama_llm # was defined above in the file 38 # 39 # from langchain_openai import ChatOpenAI 40 # llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7) 41 ) 42 writer = Agent( 43 role='Tech Content Strategist', 44 goal='Craft compelling content on tech advancements', (...) 49 # (optional) llm=ollama_llm 50 ) 52 # Create tasks for your agents

[... skipping hidden 1 frame]

File C:\ProgramData\anaconda3\Lib\site-packages\crewai\agent.py:98, in Agent.() 92 step_callback: Optional[Any] = Field( 93 default=None, 94 description="Callback to be executed after each step of the agent execution.", 95 ) 96 i18n: I18N = Field(default=I18N(), description="Internationalization settings.") 97 llm: Any = Field( ---> 98 default_factory=lambda: ChatOpenAI( 99 model=os.environ.get("OPENAI_MODEL_NAME", "gpt-4") 100 ), 101 description="Language model that will run the agent.", 102 ) 103 function_calling_llm: Optional[Any] = Field( 104 description="Language model that will run the agent.", default=None 105 ) 107 @field_validator("id", mode="before") 108 @classmethod 109 def _deny_user_set_id(cls, v: Optional[UUID4]) -> None:

File C:\ProgramData\anaconda3\Lib\site-packages\langchain_core\load\serializable.py:120, in Serializable.init(self, kwargs) 119 def init(self, kwargs: Any) -> None: --> 120 super().init(**kwargs) 121 self._lc_kwargs = kwargs

File C:\ProgramData\anaconda3\Lib\site-packages\pydantic\v1\main.py:341, in BaseModel.init(pydantic_self__, **data) 339 values, fields_set, validation_error = validate_model(pydantic_self.class, data) 340 if validation_error: --> 341 raise validation_error 342 try: 343 object_setattr(__pydantic_self, 'dict', values)

ValidationError: 1 validation error for ChatOpenAI root Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

github-actions[bot] commented 1 week ago

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.

github-actions[bot] commented 1 week ago

This issue was closed because it has been stale for 5 days with no activity.