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

GroqCloud support #136

Open
torepettersen opened this issue Jun 11, 2024 · 5 comments
Open

GroqCloud support #136

torepettersen opened this issue Jun 11, 2024 · 5 comments

Comments

@torepettersen
Copy link

Hi, thanks for creating this nice library 😊

I recently came accros GroqCloud. It seems like an alternative to OpenAI and is powered by open source moduls like Mixtral, Llama3 and Gemma. They have two big advantegaes over OpenAI which is speed and price.

So just qurious if it would be possible and makes sense to add support for GroqCloud?

@brainlid
Copy link
Owner

brainlid commented Jun 13, 2024 via email

@yvrhlp
Copy link

yvrhlp commented Jun 13, 2024

A few nuances according to Groq docs: https://console.groq.com/docs/openai

OpenAI Compatibility
Groq's APIs are designed to be compatible with OpenAI's, with the goal of making it easy to leverage Groq in applications you may have already built. However, there are some nuanced differences where support is not yet available.

The following fields are not supported and will result in a 400 error if they are supplied:

logprobs
logit_bias
top_logprobs

@brainlid
Copy link
Owner

brainlid commented Jun 13, 2024

@yvrhlp thanks! We're not using any of those. The ChatOpenAI module supports overriding the endpoint so that might be working right now.

Please let me know if you try it. There are a number of services like Groq that creating a "supported" matrix could be really helpful for people.

@torepettersen
Copy link
Author

Thanks, I made a basic test and seems to work.

iex> llm = LangChain.ChatModels.ChatOpenAI.new!(%{endpoint: "https://api.groq.com/openai/v1/chat/completions", model: "llama3-70b-8192", api_key: key})
iex> LLMChain.new!(%{llm: llm}) |> LLMChain.add_message(Message.new_user!("Hello!")) |> LLMChain.run()
%LangChain.Message{
   content: "Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat?",
   index: 0,
   status: :complete,
   role: :assistant,
   name: nil,
   tool_calls: [],
   tool_results: nil
 }

@brainlid
Copy link
Owner

brainlid commented Jun 13, 2024 via email

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

No branches or pull requests

3 participants