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

[R-224] Ragas integration with Langfuse to trace both llm outputs and scores in the same place #898

Open
databill86 opened this issue Apr 24, 2024 · 1 comment
Assignees
Labels
linear Created by Linear-GitHub Sync question Further information is requested
Milestone

Comments

@databill86
Copy link

databill86 commented Apr 24, 2024

[x ] I checked the documentation and related resources and couldn't find an answer to my question.
I checked and tested the integration of ragas with Langfuse as demonstrated here. Although a lot of the code in that page did not work, I used the evaluate function to get the scores, and I logged all the scores in Langfuse.

My Question: how to customize llm traces with ragas

Is there any way we can log the llm generations when evaluating the results using some given trace_ids ?
I already have the generations logged into langfuse, but the problem is I want to log these generations into some other corresponding trace_ids I already generated.
Is this possible ?

Code Examples

        score = evaluate(
            dataset,
            metrics=[
                context_precision,
                context_recall,
                context_relevancy,
            ],
            llm=llm_ragas,
            embeddings=embedding_model_ragas,
        )

       # at this point, the traces of all the llm generations done by ragas are already logged into langfuse. 
       # is there a way we can log them using some given trace ids ? 
        ....
        for k, v in score_row.items():
            try:
                if v not math.isnan(v):
                    langfuse.score(trace_id=trace_id, name=k, value=v)
                else:
                    logger.error(f"Score {k} is None")
            except Exception as e:
                logger.error(f"Error logging score: {e}")
....

I believe these issues are related: #896, #893

Additional context
Here are the requirements used.

langfuse==2.26.3
litellm==1.35.12
ragas==0.1.7

R-224

@databill86 databill86 added the question Further information is requested label Apr 24, 2024
@jjmachan jjmachan self-assigned this Apr 25, 2024
@jjmachan
Copy link
Member

Hey @databill86 thanks for raising this - will be fixing these issues shortly and doing a release with the fixes for you 🙂

cheers

@jjmachan jjmachan added the linear Created by Linear-GitHub Sync label Apr 25, 2024
@jjmachan jjmachan changed the title Ragas integration with Langfuse to trace both llm outputs and scores in the same place [R-224] Ragas integration with Langfuse to trace both llm outputs and scores in the same place Apr 25, 2024
@jjmachan jjmachan modified the milestones: v.1, v0.1.8, v.2 Apr 29, 2024
@jjmachan jjmachan modified the milestones: v.2, v.3, v0.1.8, v.4 May 13, 2024
@jjmachan jjmachan modified the milestones: v0.1.9, v.5 May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear Created by Linear-GitHub Sync question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants