Skip to content
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

Add OpenAI-compatible Groq #596

Closed
wants to merge 5 commits into from

Conversation

mattlindsey
Copy link
Contributor

@mattlindsey mattlindsey commented Apr 28, 2024

TODO:

  • chat method works with Groq models
  • Add tests
  • Add usage to README
  • Confirm that Assistant with tools/function-calling works ok with different models

@mattlindsey mattlindsey changed the title WIP: Add OpenAI-compatible Groq Add OpenAI-compatible Groq Apr 29, 2024
Add `gem "ruby-openai", "~> 7.0"` to your Gemfile.

```ruby
llm = Langchain::LLM::GroqOpenAI.new(api_key: ENV["GROQ_API_KEY"]) # Defaults to Meta Llama 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer to call it: Langchain::LLM::Groq. I find GroqOpenAI rather confusing as it sounds like the OpenAI models are available on Groq, which they're not.

# llm_options: {},
# default_options: {}
# )
class GroqOpenAi < OpenAI
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would build a standalone integration to Groq directly instead of subclassing OpenAI. I understand that it works but it only works because Groq is trying to mimic the OpenAI interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. By 'standalone integration' do you mean not use the ruby-openai gem? Or use the gem but don't subclass?
I liked the subclass since without it you have to define the chat method and all of its parameters and pass them through.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@mattlindsey Not use ruby-openai gem and not subclass for Groq.

@andreibondarev andreibondarev linked an issue Apr 29, 2024 that may be closed by this pull request
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.

Add support for Groq LLM
2 participants