Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
d0e0256
1
Parent(s):
9ffd75b
Simplify MCP arch #6
Browse files
agent.py
CHANGED
|
@@ -215,9 +215,6 @@ async def call_tool(name: str, arguments: dict) -> Sequence[TextContent | ImageC
|
|
| 215 |
|
| 216 |
# Generate content using Gemini API
|
| 217 |
try:
|
| 218 |
-
# Get the model instance (requires keyword argument)
|
| 219 |
-
gemini_model = gemini_client.models.get(model=model)
|
| 220 |
-
|
| 221 |
# Prepare generation config
|
| 222 |
generation_config = {
|
| 223 |
"temperature": temperature,
|
|
@@ -227,9 +224,10 @@ async def call_tool(name: str, arguments: dict) -> Sequence[TextContent | ImageC
|
|
| 227 |
# Use asyncio.to_thread to make the blocking call async
|
| 228 |
# The API accepts contents as a list and config as a separate parameter
|
| 229 |
def generate_sync():
|
| 230 |
-
return
|
|
|
|
| 231 |
contents=gemini_contents,
|
| 232 |
-
config=generation_config
|
| 233 |
)
|
| 234 |
|
| 235 |
response = await asyncio.to_thread(generate_sync)
|
|
|
|
| 215 |
|
| 216 |
# Generate content using Gemini API
|
| 217 |
try:
|
|
|
|
|
|
|
|
|
|
| 218 |
# Prepare generation config
|
| 219 |
generation_config = {
|
| 220 |
"temperature": temperature,
|
|
|
|
| 224 |
# Use asyncio.to_thread to make the blocking call async
|
| 225 |
# The API accepts contents as a list and config as a separate parameter
|
| 226 |
def generate_sync():
|
| 227 |
+
return gemini_client.models.generate_content(
|
| 228 |
+
model=model,
|
| 229 |
contents=gemini_contents,
|
| 230 |
+
config=generation_config,
|
| 231 |
)
|
| 232 |
|
| 233 |
response = await asyncio.to_thread(generate_sync)
|