-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Feature Request]: Document Groq API support #2555
Comments
What's preventing you from setting the |
groq is a "drop in replacement" just configure it based on the above, and try it out |
i tryed it with base_url, model, and api_key in llm_config, but there are errors, the communication between agents fails. It runs fine with openai. I think I see what's going on! It seems like my previous response didn't go through. Thank you for pointing it out! WARNING:autogen.agentchat.groupchat:GroupChat select_speaker failed to resolve the next speaker's name. This is because the speaker selection OAI call returned: |
it works now sometimes. With a very simple question until the end, but with this warning: so with groq often there fails the connection between the agents somehow. tryed mixtral 8 and llama3 8. |
I am also testing out groq as a replacement for gpt at the moment. I have tested all the different models available with groq and it has resulted in this error in most cases
Groq supports function calling but perhaps the way I am defining the functions with autogen is causing a problem? I have had to switch around my code to use Langchain's tool classes for function declaration as it was the only way i could resolve the problem i was having of passing a context around the tools. I believe there is a difference between tools and functions in autogen if i am correct? Does anyone have any idea how i might resolve this? Also has anyone tried llama 3 70b? |
@roundrobbin - I think it's because Groq is so fast and they have substantially reduced the token limits. It could be the case that there may be a mismatch between the self imposed rate limiting (that might or might not be baked in to AutoGen) and the capabilities of Groq |
That Groq supports function calling does not mean that the llama 3 70b model supports it... Are you sure what you are trying to do is valid? I plan also to use Groq with llama 3 70b, but without function calling. You should debug the request it makes for both (Langchain and Autogen) and compare what the difference is. Without Autogen does the function calling work for you with llama 3 70b? Regarding your question, in Openai functions have been deprecated, and tools are the way forward. The main difference I am aware is that tools can be selected multiple times and that you can force the model to use a tool. |
@WebsheetPlugin I have come back today and tested groqs llama 3 70b model with autogen and it now works, even with functions so good news! I was not aware that functions have been deprecated, I currently rely on them as i found no way with tools to provide any sort of auth values or anything to the tools for api calls. Using langchain tool classes and providing them as functions allows me to init the langchain tool with any variables i want, api keys etc Its interesting you mention the difference with being able to force the model to use a tool. I am seeing this issue currently with my testing of llama 3 70b, its not using the functions when it needs to be and instead hallucinates |
hi, can I ask you how to change to use llama 3 70b in Autogen with groq |
can everybody share the base_url,I have try for this one"https://api.groq.com/openai/v1/models",but it doesn't work |
Here you go: and later:
|
@WebsheetPlugin can you add this to our documentation? https://microsoft.github.io/autogen/docs/topics/non-openai-models/about-using-nonopenai-models, and |
Thank you so much! I have another question that how do you make sure that it uses the groq? |
It must be using Groq if there is only one entry in the config list. |
You can use gather_usage_summary from autogen.agentchat.utils import gather_usage_summary usage_summary = gather_usage_summary(engineer) Result: Here you can see that llama3-70b-8192 has been used. |
@ekzhu I have never added something to an
I have never added something to a documentation git. But I would like to do it, so I can contribute. Please just confirm:
|
Sounds good! Let's do it. |
Groq isn't really an option now because you cannot get over 30 calls a minute and most agents will make many calls so I would be careful about using too much groq now unless you are certain you can keep the call count low. |
Groq’s client provides an optional retry/max_retries parameter. Unfortunately, adding those to the config increases the chance of a the “Extract_response” from {response} is None”. Warning it will require a separate issue, but can we enable retries for Groq? |
What should be the setting for
Do you know why list_files is not called? Thanks. |
I tried using the given llm_config but it doesnt seem to work anymore? config_list = [{
"model": "llama3-70b-8192",
"api_key": "gsk_***",
"base_url": "https://api.groq.com/openai/v1"
}] when running autogen with these configurations , I am getting the following error File "D:\Anaconda3\envs\pyautogen\lib\site-packages\openai\api_requestor.py", line 775, in _interpret_response_line
raise self.handle_error_response(
openai.error.AuthenticationError: Incorrect API key provided: gsk_WhpK********************************************EetK. You can find your API key at https://platform.openai.com/account/api-keys. I dont know why this is happening , I have set the base url to groq , still its taking base url as openai if anyone has any clue why this is happening , any help will be much appreciated , |
Which autogen version are you using? |
Version -> 0.1.14 I also tried regenerating the API key, but still same issue |
These are hackers hacking me please contact fbi
…On Fri, Jun 14, 2024, 12:13 AM Jivesh Kalra ***@***.***> wrote:
Version -> 0.1.14
I also tried regenerating the API key, but still same issue
it seems like the autogen didnt take the groq's base url and instead is
always taking openai's url to authenticate / use llms
—
Reply to this email directly, view it on GitHub
<#2555 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BI3MSTDVHOFZ5ISGVWMF2BDZHJ3Y3AVCNFSM6AAAAABHBGMDH2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRXGIZDKMJSHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I am curious if anyone has been able to make Autogen work with Groq API -- in particular, their experience with function calling and tools. Thank you. |
@tarvindersi, I got it to work. The above configuration worked for me. |
I just tried using llama3-70b from Groq with Autogen. The library you need to install is "pyautogen" not "autogen" when using Python. GROQ_API_KEY = os.getenv("GROQ_API_KEY")
prompt_price_per_1k=0
completion_token_price_per_1k=0
config_list= [{"model": "llama3-70b-8192", "api_key": GROQ_API_KEY, "base_url": "https://api.groq.com/openai/v1", "price": [prompt_price_per_1k, completion_token_price_per_1k], "frequency_penalty": 0.5, "max_tokens": 2048, "presence_penalty": 0.2, "temperature": 0.5, "top_p": 0.2}]
llm_config = {"config_list":config_list} Note: The price field is to silence warnings about price calculation. |
Is your feature request related to a problem? Please describe.
AutoGen is too slow using OpenAi API and needs the speed of Groq LLM API
Describe the solution you'd like
I would like to be able to use the Groq API to run the agents, The API info is below:
import os
from groq import Groq
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Explain the importance of fast language models",
}
],
model="mixtral-8x7b-32768",
)
print(chat_completion.choices[0].message.content)
Additional context
The speed of Groq with AutoGen would be fantastic
The text was updated successfully, but these errors were encountered: