Skip to content

OpenManus with Gemini 2 million token #317

Closed

Description

@tuapuikia

I manage to use with Gemini 2.0 with 2 million token. Very useful projects.

Activity

  1. manny1185 commented on Mar 9, 2025

    @manny1185

    how much you pay?

  2. jahaskell53 commented on Mar 10, 2025

    @jahaskell53

    Gemini 2.0 is free. You can create an API key here.

  3. ThyannSeng commented on Mar 10, 2025

    @ThyannSeng

    can you shows the config example without your real api key? it's not working for me and shows 2025-03-10 19:46:03.938 | WARNING | __main__:main:19 - Processing your request... 2025-03-10 19:46:03.938 | INFO | app.agent.base:run:137 - Executing step 1/30 2025-03-10 19:46:05.511 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key. 2025-03-10 19:46:06.835 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key. 2025-03-10 19:46:08.462 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key.

  4. wielenmaker commented on Mar 10, 2025

    @wielenmaker

    Can you show which api base url you used for Gemini?

  5. ThyannSeng commented on Mar 10, 2025

    @ThyannSeng

    Can you show which api base url you used for Gemini?

    ` Global LLM configuration
    [llm]
    model = "gemini-2.0-flash"
    base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?"
    api_key = "My-free-gemini-api-key"
    max_tokens = 4096
    temperature = 0.0

    Optional configuration for specific LLM models
    [llm.vision]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?"
    api_key = "My-free-gemini-api-key"

    `

  6. pazoff commented on Mar 10, 2025

    @pazoff

    Can you show which api base url you used for Gemini?

    ` Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0

    Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    `
    I am getting( I have set the key):

    2025-03-10 09:01:08.741 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key.
    2025-03-10 09:01:09.817 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key.
    2025-03-10 09:01:11.136 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key.
    2025-03-10 09:01:12.480 | ERROR | app.llm:ask_tool:256 - Authentication failed. Check API key.

  7. ThyannSeng commented on Mar 10, 2025

    @ThyannSeng

    Can you show which api base url you used for Gemini?

    ` Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0

    Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    `

    if I use
    base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent", it shows 2025-03-10 20:16:58.184 | WARNING | __main__:main:19 - Processing your request... 2025-03-10 20:16:58.184 | INFO | app.agent.base:run:137 - Executing step 1/30 2025-03-10 20:16:59.562 | ERROR | app.llm:ask_tool:260 - API error: Error code: 404 2025-03-10 20:17:00.833 | ERROR | app.llm:ask_tool:260 - API error: Error code: 404. No idea how to make it works

  8. pazoff commented on Mar 10, 2025

    @pazoff

    Can you show which api base url you used for Gemini?

    ` Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0

    Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    `

    This Config works for me:

    #Global LLM configuration
    [llm]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    max_tokens = 4096
    temperature = 0.0
    
    #Optional configuration for specific LLM models
    [llm.vision]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    

    taken from https://ai.google.dev/gemini-api/docs/openai#python

  9. pazoff commented on Mar 10, 2025

    @pazoff

    Can you show which api base url you used for Gemini?

    Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0 Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    if I use base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent", it shows 2025-03-10 20:16:58.184 | WARNING | __main__:main:19 - Processing your request... 2025-03-10 20:16:58.184 | INFO | app.agent.base:run:137 - Executing step 1/30 2025-03-10 20:16:59.562 | ERROR | app.llm:ask_tool:260 - API error: Error code: 404 2025-03-10 20:17:00.833 | ERROR | app.llm:ask_tool:260 - API error: Error code: 404. No idea how to make it works

    Look Here: https://ai.google.dev/gemini-api/docs/openai#python

  10. ThyannSeng commented on Mar 10, 2025

    @ThyannSeng

    Can you show which api base url you used for Gemini?

    Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0 Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    This Config works for me:

    #Global LLM configuration
    [llm]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    max_tokens = 4096
    temperature = 0.0
    
    #Optional configuration for specific LLM models
    [llm.vision]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    

    taken from https://ai.google.dev/gemini-api/docs/openai#python

    Thanks! It's working.

  11. pazoff commented on Mar 10, 2025

    @pazoff

    Can you show which api base url you used for Gemini?

    Global LLM configuration [llm] model = "gemini-2.0-flash" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key" max_tokens = 4096 temperature = 0.0 Optional configuration for specific LLM models [llm.vision] model = "gemini-2.0-flash-exp" base_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?" api_key = "My-free-gemini-api-key"

    This Config works for me:

    #Global LLM configuration
    [llm]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    max_tokens = 4096
    temperature = 0.0
    
    #Optional configuration for specific LLM models
    [llm.vision]
    model = "gemini-2.0-flash-exp"
    base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
    api_key = "YOUR-API-KEY"
    

    taken from https://ai.google.dev/gemini-api/docs/openai#python

    Thanks! It's working.

    But there is other problems:
    | ERROR | app.llm:ask_tool:252 - Validation error in ask_tool: Message must contain either 'content' or 'tool_calls'

  12. manny1185 commented on Mar 10, 2025

    @manny1185

    Gemini 2.0 is free. You can create an API key here.

    Thanks,i have supply one

  13. krigeta commented on Mar 11, 2025

    @krigeta

    can we use thinking models as well?

  14. marko999 commented on Mar 11, 2025

    @marko999

    thank you for the config, that work, but that leads to rate limiting errors, now this is free 1mil token api, so it cannot be on server side and from the front side I see only one or more actual request made, so something is off in that setup

  15. yd-ccccai commented on Mar 12, 2025

    @yd-ccccai

    Using gemini api will end up with: Validation error in ask_tool: Message must contain either 'content' or 'tool_calls'
    Either flash or flash-exp.
    Maybe gemini has something error with function_call

  16. kbrajwani commented on Mar 14, 2025

    @kbrajwani

    Using gemini api will end up with: Validation error in ask_tool: Message must contain either 'content' or 'tool_calls' Either flash or flash-exp. Maybe gemini has something error with function_call

    You can easily bypass this by editing app/agent/toolcall.py.

    Add this call into a file

    class Response:
        def __init__(self):
            self.tool_calls = None
            self.content = None
    

    then add a while clause before calling the LLM.

    while (response.tool_calls == None) and (response.content == None):
                
                response = await self.llm.ask_tool(
                    messages=self.messages,
                    system_msgs=[Message.system_message(self.system_prompt)]
                    if self.system_prompt
                    else None,
                    tools=self.available_tools.to_params(),
                    tool_choice=self.tool_choices,
                )
    

    It will try to call LLM until it provides any action to take. Sometimes, LLM is not able to provide the next steps, so we end up with the issue.

  17. DKauser commented on Mar 14, 2025

    @DKauser

    Using gemini api will end up with: Validation error in ask_tool: Message must contain either 'content' or 'tool_calls' Either flash or flash-exp. Maybe gemini has something error with function_call

    You can easily bypass this by editing app/agent/toolcall.py.

    Add this call into a file

    class Response:
        def __init__(self):
            self.tool_calls = None
            self.content = None
    

    then add a while clause before calling the LLM.

    while (response.tool_calls == None) and (response.content == None):
                
                response = await self.llm.ask_tool(
                    messages=self.messages,
                    system_msgs=[Message.system_message(self.system_prompt)]
                    if self.system_prompt
                    else None,
                    tools=self.available_tools.to_params(),
                    tool_choice=self.tool_choices,
                )
    

    It will try to call LLM until it provides any action to take. Sometimes, LLM is not able to provide the next steps, so we end up with the issue.

    Would this resolve an issue with "Error in PlanningFlow: Parameter 'title' is required for command: create"?

  18. locked and limited conversation to collaborators on Mar 16, 2025
  19. converted this issue into a discussion #714 on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions