Skip to content

Conversation

@garybadwal
Copy link
Contributor

@garybadwal garybadwal commented Sep 27, 2025

Related Issues

Proposed Changes

Added a new CometAPIChatGenerator class that extends OpenAIChatGenerator to support the Comet API as a backend for chat generation.

  • Configures api_base_url to point to https://api.cometapi.com/v1.
  • Supports authentication via COMET_API_KEY environment variable (using Secret.from_env_var).
  • Allows configuration of model name, streaming callbacks, tools, retry logic, and HTTP client kwargs, same as OpenAIChatGenerator.
  • Default model is set to gpt-4o-mini.

This provides a seamless way to use CometAPI as a drop-in replacement for OpenAI within Haystack.

How did you test it?

  • Verified initialization of CometAPIChatGenerator with and without explicit parameters.
  • Tested that it correctly inherits all functionality from OpenAIChatGenerator.
  • Manually checked API base URL override (api_base_url = https://api.cometapi.com/v1).
  • Confirmed loading of API key from environment variable (COMET_API_KEY).

Notes for the reviewer

  • The main change is introducing the CometAPIChatGenerator class.
  • Implementation reuses all OpenAIChatGenerator logic, only customizing api_base_url and defaults.
  • Please review whether we should add integration tests with a real Comet API key (currently avoided to keep CI clean).

Checklist

garybadwal and others added 30 commits May 24, 2025 16:24
…der to use private attributes for initialization
@garybadwal
Copy link
Contributor Author

Hi @sjrl, just checking if you or @TensorNull can give a review to the changes requested. So I can fix things if required.

@garybadwal
Copy link
Contributor Author

Hi @sjrl, just checking if you or @TensorNull can give a review to the changes requested. So I can fix things if required.

TensorNull

This comment was marked as resolved.

Copy link

@TensorNull TensorNull left a comment

Choose a reason for hiding this comment

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

lgtm

@garybadwal
Copy link
Contributor Author

Thank you, @TensorNull! I’d also like to give a special thanks to @sjrl, who was the first person I connected with when I submitted my very first open-source contribution — the text and document embedder integration for Google GenAI. Since then, I’ve received continuous support from all of you.

I’m truly grateful to be part of such a welcoming community that helps new contributors like me.

I look forward to contributing to Haystack in the future and staying in touch with you all. Thank you again for your constant support and guidance!

@garybadwal
Copy link
Contributor Author

Hi @sjrl, just checking if we can merge this PR.

@mpangrazzi mpangrazzi self-requested a review October 21, 2025 13:19
Copy link
Contributor

@mpangrazzi mpangrazzi left a comment

Choose a reason for hiding this comment

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

@garybadwal

I think you still need to address this?

Update: we should keep README consistent with other ones (so a lot more minimal).

The current README should be instead placed as a comet-api.md file in that folder, with links / examples.

@garybadwal
Copy link
Contributor Author

@sjrl @mpangrazzi I have done the changes ✅

@garybadwal garybadwal requested review from mpangrazzi and sjrl October 24, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:cometapi topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add CometAPI as an LLM provider

5 participants