Skip to content

Commit 9777988

Browse files
add grok and gemini (#105)
1 parent e662a7c commit 9777988

File tree

4 files changed

+104
-20
lines changed

4 files changed

+104
-20
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,21 @@ Build your AI agents in three lines of code!
7777

7878
### AI Models Used
7979

80-
* [gpt-4.1](https://platform.openai.com/docs/models/gpt-4.1) (agent)
80+
**OpenAI**
81+
* [gpt-4.1](https://platform.openai.com/docs/models/gpt-4.1) (agent - can be overridden)
8182
* [gpt-4.1-nano](https://platform.openai.com/docs/models/gpt-4.1-nano) (router)
8283
* [text-embedding-3-large](https://platform.openai.com/docs/models/text-embedding-3-large) (embedding)
8384
* [tts-1](https://platform.openai.com/docs/models/tts-1) (audio TTS)
8485
* [gpt-4o-mini-transcribe](https://platform.openai.com/docs/models/gpt-4o-mini-transcribe) (audio transcription)
8586
* [gpt-image-1](https://platform.openai.com/docs/models/gpt-image-1) (image generation)
8687
* [gpt-4o-mini-search-preview](https://platform.openai.com/docs/models/gpt-4o-mini-search-preview) (Internet search)
8788

89+
**Grok**
90+
* [grok-3-fast](https://x.ai/api#pricing) (agent - optional)
91+
92+
**Gemini**
93+
* [gemini-2.5-pro-preview-03-25](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro-preview-03-25) (agent - optional)
94+
8895
## Installation
8996

9097
You can install Solana Agent using pip:
@@ -386,6 +393,30 @@ config = {
386393
}
387394
```
388395

396+
### Grok
397+
398+
`grok-3-fast` can be used instead of `gpt-4.1` for the agent model
399+
400+
```python
401+
config = {
402+
"grok": {
403+
"api_key": "your-grok-api-key",
404+
},
405+
}
406+
```
407+
408+
### Gemini
409+
410+
`gemini-2.5-pro-preview-03-25` can be used instead of `gpt-4.1` for the agent model
411+
412+
```python
413+
config = {
414+
"gemini": {
415+
"api_key": "your-gemini-api-key",
416+
},
417+
}
418+
```
419+
389420
### Knowledge Base
390421

391422
The Knowledge Base (KB) is meant to store text values and/or PDFs (extracts text) - can handle very large PDFs.

docs/index.rst

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ Installation
2323
Flows
2424
~~~~~~
2525

26-
In both flows of single and multiple agents - it is one user query to one agent using one tool (if needed).
26+
In both flows of single and multiple agents - it is one user query to one agent using one or many tools (if needed).
2727

28-
An agent can have multiple tools and will choose the best one to answer the user query.
28+
An agent can have multiple tools and will choose the best ones to fulfill the user's query.
2929

30-
Routing is determined by optimal domain expertise of the agent for the user query.
30+
Routing is determined by optimal domain expertise of the agent for the user's query.
3131

32-
When the agent uses a tool it feeds the tool output back into the agent to generate the final response.
32+
When the agent uses tools it feeds the tools output back to itself to generate the final response.
3333

3434
This is important as tools generally output unstructured and unformatted data that the agent needs to prepare for the user.
3535

@@ -39,27 +39,27 @@ Keep this in mind while designing your agentic systems using Solana Agent.
3939
4040
Single Agent
4141
42-
┌────────┐ ┌─────────┐ ┌────────┐
43-
│ │ │ │ │ │
44-
│ │ │ │ │ │
45-
│ User │◄──────►│ Agent │◄──────►│ Tool
46-
│ │ │ │ │ │
47-
│ │ │ │ │ │
48-
└────────┘ └─────────┘ └────────┘
42+
┌────────┐ ┌─────────┐ ┌────────-
43+
│ │ │ │ │
44+
│ │ │ │ │
45+
│ User │◄──────►│ Agent │◄──────►│ Tools
46+
│ │ │ │ │
47+
│ │ │ │ │
48+
└────────┘ └─────────┘ └────────-
4949
5050
5151
5252
5353
5454
Multiple Agents
5555
56-
┌────────┐ ┌──────────┐ ┌─────────┐ ┌────────┐
57-
│ │ │ │ │ │ │ │
58-
│ │ │ │ │ │ │ │
59-
┌───►│ User ├───────►│ Router ├───────►│ Agent │◄──────►│ Tool
60-
│ │ │ │ │ │ │ │ │
61-
│ │ │ │ │ │ │ │ │
62-
│ └────────┘ └──────────┘ └────┬────┘ └────────┘
56+
┌────────┐ ┌──────────┐ ┌─────────┐ ┌────────-
57+
│ │ │ │ │ │ │
58+
│ │ │ │ │ │ │
59+
┌───►│ User ├───────►│ Router ├───────►│ Agent │◄──────►│ Tools
60+
│ │ │ │ │ │ │ │
61+
│ │ │ │ │ │ │ │
62+
│ └────────┘ └──────────┘ └────┬────┘ └────────-
6363
│ │
6464
│ │
6565
│ │
@@ -332,6 +332,35 @@ Observability and Tracing - Optional
332332
},
333333
}
334334
335+
336+
Grok - Optional
337+
~~~~~~~~~~~~~~~~
338+
339+
`grok-3-fast` can be used instead of `gpt-4.1` for the agent model
340+
341+
.. code-block:: python
342+
343+
config = {
344+
"grok": {
345+
"api_key": "your-grok-api-key",
346+
},
347+
}
348+
349+
350+
Gemini - Optional
351+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352+
353+
`gemini-2.5-pro-preview-03-25` can be used instead of `gpt-4.1` for the agent model
354+
355+
.. code-block:: python
356+
357+
config = {
358+
"gemini": {
359+
"api_key": "your-gemini-api-key",
360+
},
361+
}
362+
363+
335364
Knowledge Base - Optional
336365
~~~~~~~~~~~~~~~~~~~~~~~~~~~
337366

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "solana-agent"
3-
version = "29.0.0"
3+
version = "29.1.0"
44
description = "AI Agents for Solana"
55
authors = ["Bevan Hunt <[email protected]>"]
66
license = "MIT"

solana_agent/factories/agent_factory.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,30 @@ def create_from_config(config: Dict[str, Any]) -> QueryService:
168168
output_guardrails=output_guardrails,
169169
)
170170

171+
if "gemini" in config and "api_key" in config["gemini"]:
172+
# Create primary services
173+
agent_service = AgentService(
174+
llm_provider=llm_adapter,
175+
business_mission=business_mission,
176+
config=config,
177+
api_key=config["gemini"]["api_key"],
178+
base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
179+
model="gemini-2.5-pro-preview-03-25",
180+
output_guardrails=output_guardrails,
181+
) # pragma: no cover
182+
183+
elif "grok" in config and "api_key" in config["grok"]:
184+
# Create primary services
185+
agent_service = AgentService(
186+
llm_provider=llm_adapter,
187+
business_mission=business_mission,
188+
config=config,
189+
api_key=config["grok"]["api_key"],
190+
base_url="https://api.x.ai/v1",
191+
model="grok-3-fast",
192+
output_guardrails=output_guardrails,
193+
) # pragma: no cover
194+
171195
# Create routing service
172196
routing_service = RoutingService(
173197
llm_provider=llm_adapter,

0 commit comments

Comments
 (0)