(test) traceloop logging fixes

This commit is contained in:
ishaan-jaff 2023-10-27 10:12:58 -07:00
parent 925d5caee4
commit 1eb720e447

View file

@ -1,58 +1,62 @@
# import litellm import sys
# from litellm import completion import os
# from traceloop.sdk import Traceloop import io
# Traceloop.init(app_name="test_traceloop", disable_batch=True) sys.path.insert(0, os.path.abspath('../..'))
# litellm.success_callback = ["traceloop"] import litellm
from litellm import completion
from traceloop.sdk import Traceloop
Traceloop.init(app_name="test_traceloop", disable_batch=True, traceloop_sync_enabled=False)
litellm.success_callback = ["traceloop"]
# def test_traceloop_logging(): def test_traceloop_logging():
# try: try:
# print('making completion call') print('making completion call')
# response = completion( response = completion(
# model="claude-instant-1.2", model="claude-instant-1.2",
# messages=[ messages=[
# {"role": "user", "content": "Tell me a joke about OpenTelemetry"} {"role": "user", "content": "Tell me a joke about OpenTelemetry"}
# ], ],
# max_tokens=10, max_tokens=10,
# temperature=0.2, temperature=0.2,
# ) )
# print(response) print(response)
# except Exception as e: except Exception as e:
# print(e) print(e)
# test_traceloop_logging() # test_traceloop_logging()
# def test_traceloop_tracing_function_calling(): def test_traceloop_tracing_function_calling():
# function1 = [ function1 = [
# { {
# "name": "get_current_weather", "name": "get_current_weather",
# "description": "Get the current weather in a given location", "description": "Get the current weather in a given location",
# "parameters": { "parameters": {
# "type": "object", "type": "object",
# "properties": { "properties": {
# "location": { "location": {
# "type": "string", "type": "string",
# "description": "The city and state, e.g. San Francisco, CA", "description": "The city and state, e.g. San Francisco, CA",
# }, },
# "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
# }, },
# "required": ["location"], "required": ["location"],
# }, },
# } }
# ] ]
# try: try:
# response = completion( response = completion(
# model="gpt-3.5-turbo", model="gpt-3.5-turbo",
# messages=[{"role": "user", "content": "what's the weather in boston"}], messages=[{"role": "user", "content": "what's the weather in boston"}],
# temperature=0.1, temperature=0.1,
# functions=function1, functions=function1,
# ) )
# print(response) print(response)
# except Exception as e: except Exception as e:
# print(e) print(e)
# test_traceloop_tracing_function_calling() # test_traceloop_tracing_function_calling()