statelyai / agent

Create state-machine-powered LLM agents using XState
https://stately.ai/docs/agents
105 stars 6 forks source link

Ollama adapter integration #24

Closed otrebu closed 1 week ago

otrebu commented 3 months ago

Adding a ollama adapter using https://github.com/ollama/ollama-js .

It is important to notice that ollama does not support tools/function calling, so the methods using those won't work as expected.

At the moment I worked on the "translation" of the adapter taking the openai one as the base, but I have some Typescript errors I am not completely sure how to work out. I used function overloads in types.ts but it does not seem enough.

⚠️ Please bare in mind the code has not been tested yet, I was trying to get it error free first.

davidkpiano commented 1 week ago

Thanks for the PR! Since we're now using the Vercel AI SDK, you can simply use an Ollama provider directly: https://sdk.vercel.ai/providers/community-providers/ollama