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

[BUG]litellmGemini API not working ? #1393

Closed
ANPCI opened this issue Oct 3, 2024 · 6 comments
Closed

[BUG]litellmGemini API not working ? #1393

ANPCI opened this issue Oct 3, 2024 · 6 comments
Labels
bug Something isn't working no-issue-activity

Comments

@ANPCI
Copy link

ANPCI commented Oct 3, 2024

Description

Crewai generating error when using Gemini pro api, while it's working fine with other openai models.

Steps to Reproduce

add the script to test.py and run it with poetry run python test.py

Expected behavior

it should access gemini api to generate content

Screenshots/Code snippets

import os
from langchain_google_genai import ChatGoogleGenerativeAI
from crewai import Agent, Task, Crew, Process

if name == "main":

# Set gemini pro as llm
llm = ChatGoogleGenerativeAI(
    model="gemini-pro", verbose=True, temperature=0.9, google_api_key="AIzaSyAfGxWFWyKQk5fzSBKQS4y95JB0Wv_OvYE"
)

# Create agents
screenwriter = Agent(
    role="Screenwriter",
    goal="Translate ideas into engaging scenes with vivid descriptions, snappy dialogue, and emotional depth.",
    backstory="""Former freelance screenwriter for low-budget indie films. Learned to work quickly under constraints, 
                generating multiple variations on a theme. Excels at building tension and incorporating plot twists.""",
    verbose=True,
    allow_delegation=False,
    llm=llm,
)

critic = Agent(
    role="Analytical Eye & Genre Enforcer",
    goal="Ensure stories are internally consistent, adhere to the intended genre, and maintain stylistic choices.",
    backstory="""A retired film studies professor with an encyclopedic knowledge of classic tropes, storytelling structures, 
                and audience expectations. Has a knack for spotting potential plot holes and continuity errors.""",
    verbose=True,
    allow_delegation=False,
    llm=llm,
)

story_master = Agent(
    role="Project Lead & Master Orchestrator",
    goal="Guide the overall story generation process, manage the workflow between the Screenwriter and Critic, and ensure a cohesive final product.",
    backstory="""A seasoned novelist turned game narrative designer. Has a strong understanding of both high-level plot frameworks and the detailed 
                scene creation required to immerse a reader in the world.""",
    verbose=True,
    allow_delegation=True,
    llm=llm,
)

# Get the story idea from the user
user_input = input(
    "Please provide a short story idea. You can specify the genre and theme: "
)

# Create the task
story_task = Task(
    description=f"Write a short story with the following user input: {user_input}",
    agent=story_master,
)

# Create the crew
story_crew = Crew(
    agents=[screenwriter, critic, story_master],
    tasks=[story_task],
    verbose=True,
    process=Process.sequential,
)

# Execution Flow
story_output = story_crew.kickoff()

Operating System

macOS Sonoma

Python Version

3.10

crewAI Version

0.63.6

crewAI Tools Version

0.12.1

Virtual Environment

Poetry

Evidence

Error Message in terminal :

Provider List: https://docs.litellm.ai/docs/providers

2024-10-03 16:03:06,390 - 8480485952 - llm.py-llm:104 - ERROR: Failed to get supported params: argument of type 'NoneType' is not iterable

Possible Solution

None

Additional context

Tried running the script multiple times, same issue

@ANPCI ANPCI added the bug Something isn't working label Oct 3, 2024
@punitchauhan771
Copy link

punitchauhan771 commented Oct 4, 2024

Hi

Can you try this?

from crewai import Agent, LLM, Task, Crew, Process
llm = LLM(
model="gemini/gemini-pro", temperature=0.9,
api_key=API_KEY,
)

For reference you can also check this screenshot
image

And the rest of your code:
image

@httplups
Copy link

httplups commented Oct 7, 2024

I also cannot use Gemini with VertexAI in a crew, but it works using the LiteLLM

Copy link

github-actions bot commented Nov 7, 2024

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@httplups
Copy link

httplups commented Nov 7, 2024

any updates?

Copy link

github-actions bot commented Dec 9, 2024

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

3 participants