Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

TensorNull
Copy link

Description

This PR adds CometAPI integration to mem0 as both an LLM provider and embedding provider. CometAPI is a unified API gateway providing access to 500+ AI models through a single OpenAI-compatible interface.

Fixes #3465

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

How Has This Been Tested?

Comprehensive test suite covering both LLM and embedding functionality:

LLM Tests (10 tests):

  • Configuration initialization (BaseLlmConfig and CometAPIConfig)
  • Environment variable handling (COMETAPI_KEY)
  • Response generation with and without tools
  • Response parsing with various scenarios
  • Tool calling (single and multiple tool calls)

Embedding Tests (7 tests):

  • Default and custom model configuration
  • Text preprocessing (newline removal)
  • API key handling (config and environment)
  • Multiple embedding models (text-embedding-3-small, text-embedding-3-large, ada-002)

Test Results:

✅ 17/17 tests passed
✅ Ruff code style checks passed
✅ No linting errors

Test Command:

pytest tests/llms/test_cometapi.py tests/embeddings/test_cometapi_embeddings.py -v
  • Unit Test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 05:42
@CLAassistant
Copy link

CLAassistant commented Oct 10, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements CometAPI integration for mem0, adding support for both LLM and embedding operations through CometAPI's unified API gateway that provides access to 500+ AI models. The integration follows OpenAI-compatible API patterns and includes comprehensive test coverage.

  • Adds CometAPI as both an LLM provider and embedding provider
  • Implements comprehensive configuration management with CometAPIConfig
  • Includes comprehensive test suite with 17 tests covering all functionality

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mem0/llms/cometapi.py Main LLM implementation with OpenAI-compatible client and response parsing
mem0/embeddings/cometapi.py Embedding provider implementation using OpenAI embedding API
mem0/configs/llms/cometapi.py Configuration class extending BaseLlmConfig with CometAPI-specific parameters
mem0/utils/factory.py Factory registration for both LLM and embedding providers
mem0/llms/configs.py Added cometapi to valid provider list
mem0/embeddings/configs.py Added cometapi to valid embedding provider list
tests/llms/test_cometapi.py Comprehensive LLM test suite with 10 tests
tests/embeddings/test_cometapi_embeddings.py Embedding test suite with 7 tests
docs/components/llms/models/cometapi.mdx Documentation for CometAPI integration and usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

mem0/llms/cometapi.py Show resolved Hide resolved
@parshvadaftari
Copy link
Contributor

Hey @TensorNull thanks a lot for implementing this. Putting this into our roadmap and will be added later. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support CometAPI for LLM + Embeddings

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.