Skip to content

fix: update Ollama provider to use official npm package API correctly #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 13, 2025

Conversation

bhouston
Copy link
Member

Improved Ollama Provider Implementation

This PR updates the OllamaProvider class to properly use the official Ollama npm package API. The previous implementation had some TypeScript errors and didn't fully match the Ollama package's expected formats.

Changes Made:

  1. Properly imported and used the Tool type from the Ollama package
  2. Added a convertFunctionsToTools method to transform our FunctionDefinition format to Ollama's Tool format
  3. Updated the processToolCalls method to correctly extract tool calls from Ollama's response format
  4. Fixed the message formatting for tool-related messages to match Ollama's expected format
  5. Improved the handling of optional parameters in the request options
  6. Added support for stop sequences
  7. Improved type safety by replacing any with more specific types

Testing:

The implementation has been tested with various models and works correctly with:

  • Basic text generation
  • Function/tool calling
  • Proper token usage tracking

Fixes #246

semantic-release-bot and others added 9 commits March 12, 2025 20:00
# [mycoder-agent-v1.2.0](mycoder-agent-v1.1.0...mycoder-agent-v1.2.0) (2025-03-12)

### Bug Fixes

* Fix TypeScript errors in MCP implementation ([f5837d3](f5837d3))

### Features

* Add basic Model Context Protocol (MCP) support ([8ec9619](8ec9619))
* **agent:** implement incremental resource cleanup for agent lifecycle ([576436e](576436e)), closes [#236](#236)
* background tools is now scope to agents ([e55817f](e55817f))
# [mycoder-v1.2.0](mycoder-v1.1.1...mycoder-v1.2.0) (2025-03-12)

### Features

* Add basic Model Context Protocol (MCP) support ([8ec9619](8ec9619))
* **agent:** implement incremental resource cleanup for agent lifecycle ([576436e](576436e)), closes [#236](#236)
* background tools is now scope to agents ([e55817f](e55817f))
# [mycoder-agent-v1.3.0](mycoder-agent-v1.2.0...mycoder-agent-v1.3.0) (2025-03-12)

### Features

* implement MCP tools support ([2d99ac8](2d99ac8))
# [mycoder-v1.3.0](mycoder-v1.2.0...mycoder-v1.3.0) (2025-03-12)

### Features

* implement MCP tools support ([2d99ac8](2d99ac8))
@bhouston bhouston merged commit 1bffa4d into main Mar 13, 2025
1 check passed
Copy link

🎉 This PR is included in version mycoder-agent-v1.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version mycoder-v1.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved Ollama Provider Implementation Using Official npm Package
2 participants