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

I can't use gemini pro api [BUG] #461

Open
Shakibelmolik opened this issue May 3, 2024 · 1 comment
Open

I can't use gemini pro api [BUG] #461

Shakibelmolik opened this issue May 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Shakibelmolik
Copy link

Shakibelmolik commented May 3, 2024

I get this error every time:
Initializing Autonomous Agent swarm-worker-01...
Autonomous Agent Activated.
All systems operational. Executing task...

Loop 1 of 5
Screenshot_20240504-001411_Chrome

2024-05-03T21:11:34.096437+0000 Attempt 1: Error generating response: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Error running Gemini model: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Please check the task and image: System: :
You are a fully autonomous agent serving the user in automating tasks, workflows, and activities.
Agent's use custom instructions, capabilities, and data to optimize LLMs for a more narrow set of tasks.

You will have internal dialogues with yourself and or interact with the user to aid in these tasks. 
Your responses should be coherent, contextually relevant, and tailored to the task at hand.

swarm-worker-01:
Date and Time: 2024-05-03 21:11:10

You have been assigned a task that requires the use of various tools to gather information and execute commands. 
Follow the instructions provided to complete the task effectively. This SOP is designed to guide you through the structured and effective use of tools. 
By adhering to this protocol, you will enhance your productivity and accuracy in task execution.

### Constraints
- Only use the tools as specified in the instructions.
- Follow the command format strictly to avoid errors and ensure consistency.
- Only use the tools for the intended purpose as described in the SOP.
- Document your thoughts, reasoning, and plan before executing the command.
- Provide the output in JSON format within markdown code blocks.
- Review the output to ensure it matches the expected outcome.
- Only follow the instructions provided in the SOP and do not deviate from the specified tasks unless tool usage is not required.

### Performance Evaluation
- **Efficiency**: Use tools to complete tasks with minimal steps.
- **Accuracy**: Ensure that commands are executed correctly to achieve the desired outcome.
- **Adaptability**: Be ready to adjust the use of tools based on task requirements and feedback.

### Tool Commands
1. **Browser**
   - **Purpose**: To retrieve information from the internet.
   - **Usage**:
     - `{"name": "browser", "parameters": {"query": "search query here"}}`
     - Example: Fetch current weather in London.
     - Command: `{"name": "browser", "parameters": {"query": "London weather"}}`
     
2. **Terminal**
   - **Purpose**: To execute system commands.
   - **Usage**:
     - `{"name": "terminal", "parameters": {"cmd": "system command here"}}`
     - Example: Check disk usage on a server.
     - Command: `{"name": "terminal", "parameters": {"cmd": "df -h"}}`
     
3. **Custom Tool** (if applicable)
   - **Purpose**: Describe specific functionality.
   - **Usage**:
     - `{"name": "custom_tool", "parameters": {"parameter": "value"}}`
     - Example: Custom analytics tool.
     - Command: `{"name": "custom_tool", "parameters": {"data": "analyze this data"}}`


### Usage Examples
- **Example 1**: Retrieving Weather Information
  ```json
{
  "functions": {
    "name": "browser", 
    "parameters": {
      "query": "Miami weather"
    }
  }
}
  ```
  
- **Example 2**: System Check via Terminal
  ```json
{
  "functions": {
    "name": "terminal", 
    "parameters": {
      "code": "uptime"
    }
  }
}
  ```
  
- **Example 3**: Combined Browser and Terminal Usage
  ```json
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download latest stock data for NASDAQ"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python analyze_stocks.py"
      }
    }
  ]
}
  ```
  
- **Example 4**: Combined Browser, Terminal, and Calculator Usage
    ```json
{
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download monthly expenditure data"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python process_expenditures.py"
      }
    },
    {
      "name": "calculator",
      "parameters": {
        "operation": "sum",
        "numbers": "[output_from_process_expenditures]"
      }
    }
  ]
}

    ```
    


### Next Steps
- Determine the appropriate tool for the task at hand.
- Format your command according to the examples provided.
- Execute the command and evaluate the results based on the expected outcome.
- Document any issues or challenges faced during the tool usage.
- Always output the results in the specified format: JSON in markdown code blocks.


###### Tools Available

[]

swarm-worker-01:
This function systematically breaks down the given objective into distinct, manageable subtasks.
It structures the problem-solving process through explicit step-by-step exploration,
using a methodical search tree approach. Key steps are numbered to guide the exploration of solutions.

The function emphasizes the third level of the search tree, where critical decision-making occurs.
Each potential path is thoroughly evaluated to determine its viability towards achieving the objective.
The process includes:
- Identifying initial steps in the search tree.
- Delineating and exploring critical third-level decisions.
- Considering alternative paths if initial trials are not promising.

The goal is to think atomically and provide solutions for each subtask identified,
leading to a conclusive final result. The approach is resilient, working under the premise that
all objectives are solvable with persistent and methodical exploration.

### OBJECTIVE
None
###

Human:: Generate a 10,000 word blog on mental clarity and the benefits of meditation.

, None
2024-05-03T21:11:36.047595+0000 Attempt 2: Error generating response: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Error running Gemini model: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Please check the task and image: System: :
You are a fully autonomous agent serving the user in automating tasks, workflows, and activities.
Agent's use custom instructions, capabilities, and data to optimize LLMs for a more narrow set of tasks.

You will have internal dialogues with yourself and or interact with the user to aid in these tasks. 
Your responses should be coherent, contextually relevant, and tailored to the task at hand.

swarm-worker-01:
Date and Time: 2024-05-03 21:11:10

You have been assigned a task that requires the use of various tools to gather information and execute commands. 
Follow the instructions provided to complete the task effectively. This SOP is designed to guide you through the structured and effective use of tools. 
By adhering to this protocol, you will enhance your productivity and accuracy in task execution.

### Constraints
- Only use the tools as specified in the instructions.
- Follow the command format strictly to avoid errors and ensure consistency.
- Only use the tools for the intended purpose as described in the SOP.
- Document your thoughts, reasoning, and plan before executing the command.
- Provide the output in JSON format within markdown code blocks.
- Review the output to ensure it matches the expected outcome.
- Only follow the instructions provided in the SOP and do not deviate from the specified tasks unless tool usage is not required.

### Performance Evaluation
- **Efficiency**: Use tools to complete tasks with minimal steps.
- **Accuracy**: Ensure that commands are executed correctly to achieve the desired outcome.
- **Adaptability**: Be ready to adjust the use of tools based on task requirements and feedback.

### Tool Commands
1. **Browser**
   - **Purpose**: To retrieve information from the internet.
   - **Usage**:
     - `{"name": "browser", "parameters": {"query": "search query here"}}`
     - Example: Fetch current weather in London.
     - Command: `{"name": "browser", "parameters": {"query": "London weather"}}`
     
2. **Terminal**
   - **Purpose**: To execute system commands.
   - **Usage**:
     - `{"name": "terminal", "parameters": {"cmd": "system command here"}}`
     - Example: Check disk usage on a server.
     - Command: `{"name": "terminal", "parameters": {"cmd": "df -h"}}`
     
3. **Custom Tool** (if applicable)
   - **Purpose**: Describe specific functionality.
   - **Usage**:
     - `{"name": "custom_tool", "parameters": {"parameter": "value"}}`
     - Example: Custom analytics tool.
     - Command: `{"name": "custom_tool", "parameters": {"data": "analyze this data"}}`


### Usage Examples
- **Example 1**: Retrieving Weather Information
  ```json
{
  "functions": {
    "name": "browser", 
    "parameters": {
      "query": "Miami weather"
    }
  }
}
  ```
  
- **Example 2**: System Check via Terminal
  ```json
{
  "functions": {
    "name": "terminal", 
    "parameters": {
      "code": "uptime"
    }
  }
}
  ```
  
- **Example 3**: Combined Browser and Terminal Usage
  ```json
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download latest stock data for NASDAQ"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python analyze_stocks.py"
      }
    }
  ]
}
  ```
  
- **Example 4**: Combined Browser, Terminal, and Calculator Usage
    ```json
{
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download monthly expenditure data"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python process_expenditures.py"
      }
    },
    {
      "name": "calculator",
      "parameters": {
        "operation": "sum",
        "numbers": "[output_from_process_expenditures]"
      }
    }
  ]
}

    ```
    


### Next Steps
- Determine the appropriate tool for the task at hand.
- Format your command according to the examples provided.
- Execute the command and evaluate the results based on the expected outcome.
- Document any issues or challenges faced during the tool usage.
- Always output the results in the specified format: JSON in markdown code blocks.


###### Tools Available

[]

swarm-worker-01:
This function systematically breaks down the given objective into distinct, manageable subtasks.
It structures the problem-solving process through explicit step-by-step exploration,
using a methodical search tree approach. Key steps are numbered to guide the exploration of solutions.

The function emphasizes the third level of the search tree, where critical decision-making occurs.
Each potential path is thoroughly evaluated to determine its viability towards achieving the objective.
The process includes:
- Identifying initial steps in the search tree.
- Delineating and exploring critical third-level decisions.
- Considering alternative paths if initial trials are not promising.

The goal is to think atomically and provide solutions for each subtask identified,
leading to a conclusive final result. The approach is resilient, working under the premise that
all objectives are solvable with persistent and methodical exploration.

### OBJECTIVE
None
###

Human:: Generate a 10,000 word blog on mental clarity and the benefits of meditation.

, None
2024-05-03T21:11:38.754088+0000 Attempt 3: Error generating response: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Error running Gemini model: 500 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?%24alt=json%3Benum-encoding%3Dint: TypeError: Failed to fetch
Please check the task and image: System: :
You are a fully autonomous agent serving the user in automating tasks, workflows, and activities.
Agent's use custom instructions, capabilities, and data to optimize LLMs for a more narrow set of tasks.

You will have internal dialogues with yourself and or interact with the user to aid in these tasks. 
Your responses should be coherent, contextually relevant, and tailored to the task at hand.

swarm-worker-01:
Date and Time: 2024-05-03 21:11:10

You have been assigned a task that requires the use of various tools to gather information and execute commands. 
Follow the instructions provided to complete the task effectively. This SOP is designed to guide you through the structured and effective use of tools. 
By adhering to this protocol, you will enhance your productivity and accuracy in task execution.

### Constraints
- Only use the tools as specified in the instructions.
- Follow the command format strictly to avoid errors and ensure consistency.
- Only use the tools for the intended purpose as described in the SOP.
- Document your thoughts, reasoning, and plan before executing the command.
- Provide the output in JSON format within markdown code blocks.
- Review the output to ensure it matches the expected outcome.
- Only follow the instructions provided in the SOP and do not deviate from the specified tasks unless tool usage is not required.

### Performance Evaluation
- **Efficiency**: Use tools to complete tasks with minimal steps.
- **Accuracy**: Ensure that commands are executed correctly to achieve the desired outcome.
- **Adaptability**: Be ready to adjust the use of tools based on task requirements and feedback.

### Tool Commands
1. **Browser**
   - **Purpose**: To retrieve information from the internet.
   - **Usage**:
     - `{"name": "browser", "parameters": {"query": "search query here"}}`
     - Example: Fetch current weather in London.
     - Command: `{"name": "browser", "parameters": {"query": "London weather"}}`
     
2. **Terminal**
   - **Purpose**: To execute system commands.
   - **Usage**:
     - `{"name": "terminal", "parameters": {"cmd": "system command here"}}`
     - Example: Check disk usage on a server.
     - Command: `{"name": "terminal", "parameters": {"cmd": "df -h"}}`
     
3. **Custom Tool** (if applicable)
   - **Purpose**: Describe specific functionality.
   - **Usage**:
     - `{"name": "custom_tool", "parameters": {"parameter": "value"}}`
     - Example: Custom analytics tool.
     - Command: `{"name": "custom_tool", "parameters": {"data": "analyze this data"}}`


### Usage Examples
- **Example 1**: Retrieving Weather Information
  ```json
{
  "functions": {
    "name": "browser", 
    "parameters": {
      "query": "Miami weather"
    }
  }
}
  ```
  
- **Example 2**: System Check via Terminal
  ```json
{
  "functions": {
    "name": "terminal", 
    "parameters": {
      "code": "uptime"
    }
  }
}
  ```
  
- **Example 3**: Combined Browser and Terminal Usage
  ```json
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download latest stock data for NASDAQ"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python analyze_stocks.py"
      }
    }
  ]
}
  ```
  
- **Example 4**: Combined Browser, Terminal, and Calculator Usage
    ```json
{
  "functions": [
    {
      "name": "browser",
      "parameters": {
        "query": "download monthly expenditure data"
      }
    },
    {
      "name": "terminal",
      "parameters": {
        "cmd": "python process_expenditures.py"
      }
    },
    {
      "name": "calculator",
      "parameters": {
        "operation": "sum",
        "numbers": "[output_from_process_expenditures]"
      }
    }
  ]
}

    ```
    


### Next Steps
- Determine the appropriate tool for the task at hand.
- Format your command according to the examples provided.
- Execute the command and evaluate the results based on the expected outcome.
- Document any issues or challenges faced during the tool usage.
- Always output the results in the specified format: JSON in markdown code blocks.


###### Tools Available

[]

swarm-worker-01:
This function systematically breaks down the given objective into distinct, manageable subtasks.
It structures the problem-solving process through explicit step-by-step exploration,
using a methodical search tree approach. Key steps are numbered to guide the exploration of solutions.

The function emphasizes the third level of the search tree, where critical decision-making occurs.
Each potential path is thoroughly evaluated to determine its viability towards achieving the objective.
The process includes:
- Identifying initial steps in the search tree.
- Delineating and exploring critical third-level decisions.
- Considering alternative paths if initial trials are not promising.

The goal is to think atomically and provide solutions for each subtask identified,
leading to a conclusive final result. The approach is resilient, working under the premise that
all objectives are solvable with persistent and methodical exploration.

### OBJECTIVE
None
###

Human:: Generate a 10,000 word blog on mental clarity and the benefits of meditation.

, None
None
2024-05-03T21:11:38.756997+0000 Failed to generate a valid response after retry attempts.

The script:

from swarms.models.gemini import Gemini
from swarms.structs import Agent

Your actual API key

api_key = "APIiiiiiiiiiiiiiiii"

Initialize the Gemini model with your API key

llm = Gemini(
gemini_api_key=api_key,
temperature=0.5,
# Uncomment and set the following if needed
model_name="gemini-pro",
# max_tokens=100,
)

Initialize the workflow agent with the Gemini model

agent = Agent(
llm=llm,
max_loops=5,
dashboard=True,
# Uncomment and configure the following if needed
# tools = [search_api, slack, ],
# stopping_condition=None,
# loop_interval=1,
# retry_attempts=3,
# retry_interval=1,
# interactive=False,
# dynamic_temperature=False,
)

Define the task for the agent

task = "Generate a 10,000 word blog on mental clarity and the benefits of meditation."

Run the workflow on the task

out = agent.run(task)

Print the output

print(out)

We used google colab to run

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@Shakibelmolik Shakibelmolik added the bug Something isn't working label May 3, 2024
Copy link

github-actions bot commented May 3, 2024

Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants