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] #2421

Open
PremKumar135 opened this issue Mar 20, 2025 · 1 comment · May be fixed by #2423
Open

[BUG] #2421

PremKumar135 opened this issue Mar 20, 2025 · 1 comment · May be fixed by #2423
Labels
bug Something isn't working

Comments

@PremKumar135
Copy link

Description

Whenever i wanted to my agent to product a pydantic model output by giving a pydantic model to output_pydantic parameter, it is working somtimes or failing most of the time by giving this message
Failed to add to long term memory: Failed to convert text into a Pydantic model due to error: No module named 'google.genai' irrespective of success or failure. Because of this i cannot use that task in the next flow.

Steps to Reproduce

Create a simple agent and pydantic model and in agent , give that pydantic model as a output_pydantic, we can see the error

Expected behavior

It should work without any error message and the next agent should understand that it is a pydantic model and the second agent should be able convert that into a string automatically and and work from there. Or we should have the option of what key value pair from the pydantic model of the first agent can be given as a input to second agent.

Screenshots/Code snippets

class ResponseFormat(BaseModel):
string : str = Field(description = 'string needs to manitained')

class FirstFlowCrew:

def first_crew(self, param):
    first_agent = Agent(role = "role mentioned",
                            goal = dedent( f"""Goals mentioned"""),
                            backstory = dedent("""Back story mentioned"""),
                            tools=[tool mentioned],
                            verbose=True,
                            allow_delegation=True,
                            memory = True
                        )

   task_1 = Task(description = "Task description mentioned",
                               expected_output = "expected output mentioned.",
                               agent = first_agent
                            )
    

    second_agent = Agent(role='role mentioned',
                               goal = dedent("""goal mentioned"""),
                                backstory= "back story mentioned",
                                
                            )
    
    task_2 = Task(description = "task mentioned",
                             expected_output = "expected output metioned",
                             agent = second_agent,
                            output_pydantic=ResponseFormat
                            )

    first_crew = Crew(agents = [first_agent, second_agent], 
                tasks = [task_1, task_2], 
                process = 'sequential',
                verbose = True,
                memory=True
                )
    
    result = first_crew.kickoff()
    return result

Operating System

Other (specify in additional context)

Python Version

3.12

crewAI Version

0.108.0

crewAI Tools Version

0.38.1

Virtual Environment

Venv

Evidence

Image

Possible Solution

None

Additional context

None

@PremKumar135 PremKumar135 added the bug Something isn't working label Mar 20, 2025
devin-ai-integration bot added a commit that referenced this issue Mar 20, 2025
Co-Authored-By: Joe Moura <joao@crewai.com>
@Vidit-Ostwal
Copy link
Contributor

Can you try pip install google-generativeai

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

Successfully merging a pull request may close this issue.

2 participants