crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Issue in reading through csv file using OLLAMA

Open mustangs0786 opened this issue 9 months ago • 6 comments

from crewai_tools import CSVSearchTool tool = CSVSearchTool(csv='record.csv', config=dict( llm=dict( provider="ollama", config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="ollama", config=dict( model="llama2", #task_type="retrieval_document", # title="Embeddings", ), ), ) )

Trip planner

import os from crewai import Agent, Task, Crew, Process from crewai_tools import SerperDevTool

from langchain.llms import Ollama ollama_llm = Ollama(model="llama2",temperature=0)

Define your agents with roles and goals

csv_agent = Agent( role='Master in analyzing csv file', goal='Select all information about given emp_id ', backstory='An expert in analyzing csv files', verbose=True, allow_delegation=True, tools=[tool], llm = ollama_llm, system_template = )

identify_task = Task(

description=f"""

extract all information related to search_query : 2633 """,

expected_output="""concise summary.""",

agent=csv_agent,

)

Instantiate your crew with a sequential process

crew = Crew( agents=[ csv_agent ], tasks=[identify_task], verbose=True )

Get your crew to work!

result = crew.kickoff()

########## Output

ction: Search a CSV's content(search_query: '2633') Action Input: {'emp_id': 2633}

Action 'Search a CSV's content(search_query: '2633')' don't exist, these are the only available Actions: Search a CSV's content: Search a CSV's content(search_query: 'string') - A tool that can be used to semantic search a query the cpml_updated.csv CSV's content.

Please help me where i am doing wrong... thanks

mustangs0786 avatar May 09 '24 17:05 mustangs0786

You need to attach the LLM to the Agent, not the Tool

Refer to crewAI docs to learn more

slavakurilyak avatar May 12 '24 17:05 slavakurilyak

Thanks for replying but i am attaching LLM to agent only , can you please elaborate more thanks. hoping for faster reply. thanks

mustangs0786 avatar May 12 '24 17:05 mustangs0786

You only need csv as input for this tool, as per crewAI-tools

config is not necessary for crewAI tools

slavakurilyak avatar May 12 '24 23:05 slavakurilyak

why i put config because it is require otherwise by defualt it will use gpt.

can you please provide a sample working example.. thanks

mustangs0786 avatar May 13 '24 05:05 mustangs0786

@mustangs0786 just use a modelfile following documentation and then reference the model, e.g.:

from langchain_openai import ChatOpenAI
import os 

os.environ["OPENAI_API_KEY"] = ""

ollama_llm = ChatOpenAI(
                 model_name='crewai-llama2',
                 base_url = "http://localhost:11434/v1"
          ) 

danielgen avatar May 13 '24 14:05 danielgen

from langchain.llms import Ollama ollama_llm = Ollama(model="llama2",temperature=0)

from langchain.llms import Ollama ollama_llm = Ollama(model="llama2",temperature=0)

is above way of using ollama model and what you mentioned is different or same??

mustangs0786 avatar May 13 '24 16:05 mustangs0786

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] avatar Aug 17 '24 12:08 github-actions[bot]

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

github-actions[bot] avatar Aug 23 '24 12:08 github-actions[bot]