Skip to content

feat: Add ModelsLab ChatGenerator for Haystack#2977

Closed
adhikjoshi wants to merge 1 commit intodeepset-ai:mainfrom
adhikjoshi:feat/modelslab-chat-generator
Closed

feat: Add ModelsLab ChatGenerator for Haystack#2977
adhikjoshi wants to merge 1 commit intodeepset-ai:mainfrom
adhikjoshi:feat/modelslab-chat-generator

Conversation

@adhikjoshi
Copy link
Copy Markdown

Summary

Add a new ModelsLabChatGenerator component to the Haystack integrations repository, enabling users to use ModelsLab API for chat completions.

Changes

  • Added modelslab-haystack package with a ChatGenerator component
  • Supports ModelsLab's OpenAI-compatible chat completions endpoint
  • Configurable model, generation parameters (temperature, max_tokens, etc.), and timeout
  • Follows the same patterns as other integrations (anthropic, cohere, etc.)

Usage

from haystack_integrations.components.generators.modelslab import ModelsLabChatGenerator
from haystack.dataclasses import ChatMessage

generator = ModelsLabChatGenerator(
    model="meta-llama/Meta-Llama-3.1-70B-Instruct",
    generation_kwargs={
        "temperature": 0.7,
        "max_tokens": 500,
    }
)

messages = [
    ChatMessage.from_system("You are a helpful assistant."),
    ChatMessage.from_user("What is Python?"),
]

result = generator.run(messages=messages)

Testing

  • All 6 unit tests pass
  • Tests cover: initialization, serialization/deserialization, message conversion, and basic run

About ModelsLab

ModelsLab is an AI API platform offering access to various LLMs, image generation, and more at competitive pricing. Visit https://modelslab.com for more info.

Checklist

  • Code follows project conventions
  • Tests included and passing
  • Documentation added
  • No hardcoded API keys (uses MODELSLAB_API_KEY env var)

Submitted by: @adhikjoshi

@adhikjoshi adhikjoshi requested a review from a team as a code owner March 17, 2026 22:55
@adhikjoshi adhikjoshi requested review from julian-risch and removed request for a team March 17, 2026 22:55
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Adhik Joshi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Mar 17, 2026
- Add ChatGenerator component for ModelsLab API
- Support for OpenAI-compatible chat completions endpoint
- Configurable model, generation kwargs, and timeout
- Unit tests included
- Follows haystack-integrations pattern (anthropic, cohere)
@adhikjoshi adhikjoshi force-pushed the feat/modelslab-chat-generator branch from 564d27d to 269110c Compare March 18, 2026 13:03
@julian-risch julian-risch self-assigned this Mar 31, 2026
@julian-risch
Copy link
Copy Markdown
Member

Hi @adhikjoshi thank you for your initiative and for opening this pull request! We discussed the new integration in the team and we couldn't agree on merging the new integration at this point in time. Instead, I would like to encourage you to publish it yourself. We just updated our repository template, which makes it very easy to publish a PyPI package of the integration yourself. Very little effort: https://github.com/deepset-ai/custom-component

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

Labels

type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants