from maxim.logger.logger import TraceConfig
import uuid
trace = logger.trace(TraceConfig(id=str(uuid.uuid4()), name='litellm-generation'))
trace.event(str(uuid.uuid4()), 'litellm-generation', 'litellm-generation', {})
# Attach trace to LiteLLM call using metadata
response = await acompletion(
model='openai/gpt-4o',
api_key=os.getenv('OPENAI_API_KEY'),
messages=[{'role': 'user', 'content': 'What can you do for me!'}],
metadata={'maxim': {'trace_id': trace.id, 'span_name': 'litellm-generation'}}
)
print(response.choices[0].message.content)