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

Integration with Langfuse? #515

Open
gabrielfior opened this issue Apr 25, 2024 · 1 comment
Open

Integration with Langfuse? #515

gabrielfior opened this issue Apr 25, 2024 · 1 comment

Comments

@gabrielfior
Copy link

How can I pass a Langfuse callback handler to CrewAI so that the traces are available on their web UI? Here's what I have so far

from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
            model=self.model,
            api_key=keys.openai_api_key.get_secret_value(),
            temperature=0.0,
            callbacks=[LangfuseCallbackHandler()],
        )
# this produces traces on Langfuse Web UI - similarly, `llm.predict`, `chain.run` also do
llm.invoke("What are some theories about the relationship between unemployment and inflation?" )

# this does not produce traces
predictor = Agent(
            role="Professional Gambler",
            goal="XXX",
            backstory="XXX",
            llm=llm,
        )
     
task_final_decision = Task(
            description=MY_PROMPT,
            agent=predictor,
        )

 crew = Crew(
            agents=[predictor],
            tasks=[task_final_decision],
            verbose=2,
        )

crew.kickoff()

Any guidance around this integration much appreciated.

@cracksauce
Copy link

Commenting in support, would be a huge fan of this integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants