default langfuse flush

This commit is contained in:
ishaan-jaff 2023-08-31 11:43:20 -07:00
parent 01d4a4bb0b
commit f4b209ca65
2 changed files with 5 additions and 7 deletions

View file

@ -34,7 +34,6 @@ class LangFuseLogger:
# print(response_obj['usage']['prompt_tokens']) # print(response_obj['usage']['prompt_tokens'])
# print(response_obj['usage']['completion_tokens']) # print(response_obj['usage']['completion_tokens'])
generationStartTime = datetime.now()
self.Langfuse.generation(InitialGeneration( self.Langfuse.generation(InitialGeneration(
name="litellm-completion", name="litellm-completion",
startTime=start_time, startTime=start_time,
@ -48,7 +47,7 @@ class LangFuseLogger:
completion_tokens=response_obj['usage']['completion_tokens'] completion_tokens=response_obj['usage']['completion_tokens']
), ),
)) ))
self.Langfuse.flush()
print_verbose( print_verbose(
f"Langfuse Layer Logging - final response object: {response_obj}" f"Langfuse Layer Logging - final response object: {response_obj}"
) )

View file

@ -1,6 +1,6 @@
# #### What this tests #### #### What this tests ####
# # This tests if logging to the llmonitor integration actually works # This tests if logging to the llmonitor integration actually works
# # Adds the parent directory to the system path # Adds the parent directory to the system path
# import sys # import sys
# import os # import os
@ -33,14 +33,13 @@
# def test_chat_openai(): # def test_chat_openai():
# litellm.success_callback = ["langfuse"] # litellm.success_callback = ["langfuse"]
# try: # try:
# response = completion(model="gpt-3.5-turbo", # response = completion(model="replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1",
# messages=[{ # messages=[{
# "role": "user", # "role": "user",
# "content": "Hi 👋 - i'm openai" # "content": "Hi 👋 - i'm openai"
# }]) # }])
# print(response) # print(response)
# except Exception as e: # except Exception as e:
# print(e) # print(e)