docs(langfuse): add chatlitellm section

This commit is contained in:
Udit 2024-03-16 03:24:00 +05:30
parent a5b8fb0ee7
commit acd56b174c
2 changed files with 30 additions and 1 deletions

View file

@ -133,3 +133,6 @@ chat(messages)
```
</TabItem>
</Tabs>
## Langfuse Integration
Checkout this section [here](../observability/langfuse_integration#chatlitellm-integration) for more details on how to integrate langfuse with ChatLiteLLM.

View file

@ -132,6 +132,32 @@ print(response)
```
### ChatLiteLLM Integration
Pass `trace_user_id`, `session_id` in model_kwargs
```python
import os
from langchain.chat_models import ChatLiteLLM
from langchain.schema import HumanMessage
os.environ['OPENAI_API_KEY'] = ""
chat = ChatLiteLLM(
model="gpt-3.5-turbo"
model_kwargs={
"metadata": {
"trace_user_id": "user-id2", # set langfuse Trace User ID
"session_id": "session-1" , # set langfuse Session ID
"tags": ["tag1", "tag2"]
}
}
)
messages = [
HumanMessage(
content="what model are you"
)
]
chat(messages)
```
## Troubleshooting & Errors
### Data not getting logged to Langfuse ?
@ -142,4 +168,4 @@ print(response)
- [Schedule Demo 👋](https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version)
- [Community Discord 💭](https://discord.gg/wuPM9dRgDw)
- Our numbers 📞 +1 (770) 8783-106 / ‭+1 (412) 618-6238‬
- Our emails ✉️ ishaan@berri.ai / krrish@berri.ai
- Our emails ✉️ ishaan@berri.ai / krrish@berri.ai