crewAIInc / crewAI-tools

MIT License
672 stars 233 forks source link

TXTSearchTool with ollama #89

Open fre391 opened 3 months ago

fre391 commented 3 months ago

Search is NOT limited to given txt file.

` from crewai_tools import TXTSearchTool

txt_search_tool = TXTSearchTool( txt="kunst.txt", config=dict( llm=dict( provider="ollama", config=dict( model="llama3.1", ), ), embedder=dict( provider="ollama", config=dict( model="mxbai-embed-large", ), ), ) ) `

No error message and at the end the best result is shown, but in between (Verbose) it will also show snippets from other sources, f.e. of a PDF which was searched by XMLSearchTool earlier by using a seperate script....

iNLyze commented 1 month ago

@fre391, nice solution, though I am not yet getting it to work. I am trying to apply the text tool to a local file like so:

tool_txt_search = TXTSearchTool(
    txt=path/'nonsense.txt',
    config=config, 
    verbose=True
)

My config:

config=dict(
    llm=dict(
        provider="ollama",  # Change this to your LLM provider
        config=dict(
            model="llama3.1",  # Specify the model you want to use
        ),
    ),
    embedder=dict(
        provider="ollama",  # Change this to your LLM provider
        config=dict(
            model="mxbai-embed-large",  # Specify the embedding model 
        ),
    ),
)

Running this from jupyter currently (on a server via ssh). Unfortunately, the instantiation never seems to finish. I am not seeing any text output and nothing in journalctl -u ollama either.

How long does it take you to instantiate the tool? Any idea, why it might get stuck?

kspviswa commented 1 day ago

+1 . Also facing the same issue.