deepset-ai / haystack

:mag: AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
https://haystack.deepset.ai
Apache License 2.0
17.17k stars 1.88k forks source link

Rename GPT Generators for broader model compatibility #6587

Closed vblagoje closed 9 months ago

vblagoje commented 10 months ago

Summary

We propose renaming GPTGenerator and GPTChatGenerator to CompletionGenerator and ChatCompletionGenerator, respectively. This change aims to reflect the increasing adoption of the underlying format and chat completion openai library by various providers like deepinfra.com, together.ai, and anyscale, among others.

Background

Our current implementation utilizes GPTGenerator for supporting non-chat OpenAI models and GPTChatGenerator for chat-based models. However, the landscape of language models and their integrations has evolved significantly. Providers such as deepinfra, together.ai, and anyscale are deploying diverse models that utilize the same python library and message format originally popularized by OpenAI.

The current naming of GPTGenerator and GPTChatGenerator implicitly suggests that these components are exclusive to GPT models or OpenAI's platform. This naming convention could be misleading and restrictive as the components are now more universally applicable.

Proposed Solution

We suggest renaming:

This renaming will more accurately represent the functionality of these components as they are now used to interface with a variety of models across different platforms. It will also enhance clarity and inclusivity for users who are working with models from providers other than OpenAI.

The change primarily involves renaming the components. Users will be able to leverage these renamed components (CompletionGenerator and ChatCompletionGenerator) to interact with different models by simply setting parameters like model_name and api_base_url. This update ensures compatibility and extends the usability of our toolset across a broader range of platforms and models.

Deprecation plan

We can maintain references to original class names, redirecting to the new CompletionGenerator and ChatCompletionGenerator classes, respectively. This transitional phase will ensure backward compatibility and minimize disruption for current users.

sahusiddharth commented 10 months ago

@vblagoje do you think changing the file name will also be required as these functions are inside openai.py?

vblagoje commented 10 months ago

Hmm, good point @sahusiddharth - I'll consult internally with my colleagues but my guess is that since we export both classes in generators and generators.chat modules - I don't think it is necessary. Will confirm.