From c7b7fb563e1a97cc93a00c40c8e4ab30ca8e7c4e Mon Sep 17 00:00:00 2001 From: Guangya Liu Date: Wed, 27 Nov 2024 11:41:42 -0500 Subject: [PATCH] updated watsonx and crewai (#228) --- crew/crewai_watsonx_litellm.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/crew/crewai_watsonx_litellm.py b/crew/crewai_watsonx_litellm.py index 5269907..8dcc5e1 100644 --- a/crew/crewai_watsonx_litellm.py +++ b/crew/crewai_watsonx_litellm.py @@ -19,29 +19,10 @@ search_tool = DuckDuckGoSearchRun() scrape_tool = ScrapeWebsiteTool() -model_id = "meta-llama/llama-3-70b-instruct" -parameters = { - "decoding_method": "sample", - "max_new_tokens": 1000, - "temperature": 0.7, - "top_k": 50, - "top_p": 1, - "repetition_penalty": 1 -} - api_key = os.getenv("WATSONX_API_KEY") project_id = os.getenv("WATSONX_PROJECT_ID") url = os.getenv("WATSONX_URL") -credentials = Credentials(url=url, api_key=api_key) - -ibm_model = Model( - model_id=model_id, - params=parameters, - credentials=credentials, - project_id=project_id -) - WATSONX_MODEL_ID = "watsonx/ibm/granite-13b-chat-v2" custom_llm = LLM( @@ -92,7 +73,8 @@ class JsonOutput(BaseModel): data_collector_task = Task( description='Collect stock data for {company_name} from their company website {company_website} and yahoo finance site {yahoo_finance} for the past month', expected_output="A comprehensive dataset containing daily stock prices, trading volumes, and any significant news or events affecting these stocks over the past month.", - agent=data_collector + agent=data_collector, + output_json=JsonOutput ) financial_analyst_task = Task( @@ -110,6 +92,7 @@ class JsonOutput(BaseModel): ) # Create the crew +''' financial_crew = Crew( agents=[ data_collector, @@ -123,6 +106,17 @@ class JsonOutput(BaseModel): ], process=Process.sequential ) +''' + +financial_crew = Crew( + agents=[ + data_collector, + ], + tasks=[ + data_collector_task, + ], + process=Process.sequential +) inputs = { 'company_name': 'Tesla Inc.',