Skip to content

Commit

Permalink
updated watsonx and crewai (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyliu513 authored Nov 27, 2024
1 parent 130a3ca commit c7b7fb5
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions crew/crewai_watsonx_litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -110,6 +92,7 @@ class JsonOutput(BaseModel):
)

# Create the crew
'''
financial_crew = Crew(
agents=[
data_collector,
Expand All @@ -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.',
Expand Down

0 comments on commit c7b7fb5

Please sign in to comment.