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
feat(agent/core): Add GroqProvider
#7130
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for auto-gpt-docs canceled.
|
PR Description updated to latest commit (976396c)
|
PR Review 🔍
|
PR Code Suggestions ✨
|
Changelog updates: 🔄 2024-05-07Added
|
PR Analysis 🔬
💡 Usage guide:Using static code analysis capabilities, the The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR:
Language that are currently supported: Python, Java, C++, JavaScript, TypeScript, C#. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7130 +/- ##
==========================================
- Coverage 44.63% 44.45% -0.19%
==========================================
Files 133 134 +1
Lines 6309 6454 +145
Branches 823 848 +25
==========================================
+ Hits 2816 2869 +53
- Misses 3382 3472 +90
- Partials 111 113 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ChatModelInfo( | ||
name=GroqModelName.LLAMA3_8B, | ||
provider_name=ModelProviderName.GROQ, | ||
prompt_token_cost=0.05 / 1e6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider the following format 1_000_000
rather than 1e6
## GROQ_API_KEY - Groq API Key (Example: gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) | ||
# GROQ_API_KEY= | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GROQ_API_BASE_URL missing
@@ -23,6 +23,7 @@ Configuration is controlled through the `Config` object. You can set configurati | |||
- `GITHUB_USERNAME`: GitHub Username. Optional. | |||
- `GOOGLE_API_KEY`: Google API key. Optional. | |||
- `GOOGLE_CUSTOM_SEARCH_ENGINE_ID`: [Google custom search engine ID](https://programmablesearchengine.google.com/controlpanel/all). Optional. | |||
- `GROQ_API_KEY`: Set this if you want to use Groq models with AutoGPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GROQ_API_BASE
@@ -143,16 +144,17 @@ def _get_provider(self, provider_name: ModelProviderName) -> ChatModelProvider: | |||
@classmethod | |||
def _get_model_provider_class( | |||
cls, model_name: ModelName | |||
) -> type[AnthropicProvider | OpenAIProvider]: | |||
) -> type[AnthropicProvider | GroqProvider | OpenAIProvider]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type alias this like ModelName
is above
|
||
|
||
class GroqConfiguration(ModelProviderConfiguration): | ||
fix_failed_parse_tries: int = UserConfigurable(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a from_env right?
|
||
@classmethod | ||
def get_tokenizer(cls, model_name: GroqModelName) -> ModelTokenizer: | ||
# HACK: No official tokenizer is available for Claude 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment here
|
||
@classmethod | ||
def count_tokens(cls, text: str, model_name: GroqModelName) -> int: | ||
return 0 # HACK: No official tokenizer is available for Claude 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment here, and give an attempt at counting tokens lol
messages: ChatMessage | list[ChatMessage], | ||
model_name: GroqModelName, | ||
) -> int: | ||
return 0 # HACK: No official tokenizer is available for Claude 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment here, and give an attempt at counting tokens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, I'd take tiktoken and hope for the best
Why do we need a new provider, when Groq is compatible with OpenAI and just needs the base_url changing? |
We would want a provider to support additional models with different features, costs, and requirements than OpenAI. Currently, we support anthropic and OpenAI, and both require different things like the above. In the future, this is where things like a rate limit to prevent overages would live as well. |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Background
This has issues with the profile generator, so maybe merge #7121 first
Changes 🏗️
GroqProvider
model_providers.groq
model_providers.multi
PR Quality Scorecard ✨
+2 pts
+5 pts
+5 pts
+5 pts
-4 pts
+4 pts
+5 pts
-5 pts
agbenchmark
to verify that these changes do not regress performance?+10 pts
PR Type
Enhancement
Description
GroqProvider
to manage interactions with the Groq API, including methods for chat completions and API retries.multi.py
to integrateGroqProvider
alongside other model providers.ModelProviderName
enum to includeGROQ
.groq
package to project dependencies to ensure API interaction capabilities.Changes walkthrough 📝
groq.py
Implement GroqProvider for Groq API Interaction
autogpts/autogpt/autogpt/core/resource/model_providers/groq.py
GroqProvider
class for handling interactions with theGroq API.
retries.
multi.py
Integrate GroqProvider into MultiProvider
autogpts/autogpt/autogpt/core/resource/model_providers/multi.py
GroqProvider
to the list of model providers.ModelName
type to includeGroqModelName
.GROQ_CHAT_MODELS
in the combined chat models dictionary.schema.py
Update ModelProviderName Enum with GROQ
autogpts/autogpt/autogpt/core/resource/model_providers/schema.py
GROQ
to theModelProviderName
enum.pyproject.toml
Add Groq Dependency in pyproject.toml
autogpts/autogpt/pyproject.toml
groq
package as a dependency.