Skip to content

how to change trace name from litellm-acompletion #4272

Closed Answered by ishaan-jaff
deepakdeore2004 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @deepakdeore2004

Like this

import litellm
from litellm import completion
import os

# from https://cloud.langfuse.com/
os.environ["LANGFUSE_PUBLIC_KEY"] = ""
os.environ["LANGFUSE_SECRET_KEY"] = ""

os.environ['OPENAI_API_KEY']=""

# set langfuse as a callback, litellm will send the data to langfuse
litellm.success_callback = ["langfuse"] 

# set custom langfuse trace params and generation params
response = completion(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Hi 👋 - i'm openai"}
  ],
  metadata={
      "generation_name": "ishaan-test-generation",  # set langfuse Generation Name
      "generation_id": "gen-id22",                  # set langfuse Generation ID 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ishaan-jaff
Comment options

Answer selected by ishaan-jaff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants