Hi everyone, I have a question. Can we integrate C...
# marvin-ai
d
Hi everyone, I have a question. Can we integrate ControlFlow with Ollama or something else? I checked the documentation but can't find anything about it. I want to integrate ControlFlow with Llama 3.2 or something else.
j
Hi @David Cummins, I haven't tested CF with Ollama myself but there is a langchain package for it that supports function calling, so it should work (though it may need provider tuning depending on the API rules). You can follow the docs here to install and configure an alternative model. If it works well in your testing, let me know and we can add it as an automatically configurable provider like anthropic or groq!
d
@Jeremiah Sure, I'll try to figure it out and let you know!
j
Please do!
prefect rocket 1
d
@Jeremiah I'd tired and it was just working... The result was not good.
Copy code
from langchain_ollama import ChatOllama
import controlflow as cf
from controlflow.tasks.validators import between

cf.defaults.model = ChatOllama(
    model = "llama3.2",
)


optimist = cf.Agent()

def sentiment(text: str) -> float:
    return cf.run(
        "Classify the sentiment of the text as a value between 0 and 1",
        agents=[optimist],
        result_type=float,
        result_validator=between(0, 1),
        context={"text": text},
    )

sentiment("I love ControlFlow!")
Here goes the code I used.
And here goes the result
It's working correctly with gpt-4
cc @Jeremiah
j
The 3b model seems to get really confused by certain tools and maybe non-string types in my quick experimentation
stuff like "write a poem about X" or even "Is this a positive sentence? 'I love ControlFlow'" works. Asking it to classify in the raw Ollama prompt even works. But something about the classify request is tripping it up!
Mine often go into a spiral of hallucinating tool calls
Will keep trying
d
Thanks @Jeremiah
Looking forward to having an update on it