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

DOC: <Issue related to /how_to_guides/tracing/log_llm_trace> #340

Open
YassineRjl opened this issue Jul 6, 2024 · 1 comment
Open

DOC: <Issue related to /how_to_guides/tracing/log_llm_trace> #340

YassineRjl opened this issue Jul 6, 2024 · 1 comment

Comments

@YassineRjl
Copy link

Hi there, I'm using RunTree and want to log the cost, I figured out how to add the token count but not the cost. Can someone guide me please?

PS: The provider openai and gpt-4 are just values to test with. I figured if it works for them it'll work for the other custom models I'm using like Command-R

Reference: https://docs.smith.langchain.com/how_to_guides/tracing/log_llm_trace#manually-provide-token-counts

   trace.end({
      data,
      usage_metadata: {
        input_tokens: 27,
        output_tokens: 13,
        total_tokens: 40,
        total_cost: ((inCost ?? 0) + (outCost ?? 0)),
        prompt_cost: inCost,
        completion_cost: outCost,
      },
      ls_provider: 'openai',
      ls_model_name: 'gpt-4',
    });
@hinthornw
Copy link
Collaborator

Hi there! Cost is added in the UI via the models page

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