Monitoring DeepSeek models
DeepSeek provides open-weight AI models that can be integrated into diverse workflows, from conversational AI to software development. This guide shows you how to instrument an application using DeepSeek models with OpenLLMetry to send telemetry data to Instana.
Prerequisites
Make sure that the following prerequisites are met:
- Python 3.8 or later
- A Groq API key (DeepSeek models are available through Groq)
- An Instana backend account with Generative AI observability enabled
- Review of Getting Started with Generative AI Observability on agent and agentless modes
Instrumenting your DeepSeek application
- Install the required packages.
pip install groq traceloop-sdk -
Export your Groq API key.
export GROQ_API_KEY="<your-groq-api-key>" -
Create your DeepSeek application. Create a Python file with the following code:
from traceloop.sdk import Traceloop from traceloop.sdk.decorators import workflow from groq import Groq # Initialize OpenLLMetry Traceloop.init(app_name="deepseek_app", disable_batch=True) # Initialize Groq client client = Groq() @workflow(name="deepseek_conversation") def ask_deepseek(question: str): """Send a question to DeepSeek and get a response.""" response = client.chat.completions.create( messages=[{"role": "user", "content": question}], model="deepseek-r1-distill-llama-70b", ) # Remove thinking tags from response result = ( response.choices[0] .message.content.replace("<think>", "") .replace("</think>", "") ) return result.strip() # Example usage if __name__ == "__main__": questions = [ "How does transfer learning improve AI model performance?", "What are the challenges in scaling LLMs for enterprise use?" ] for question in questions: print(f"\nQuestion: {question}") answer = ask_deepseek(question) print(f"Answer: {answer}\n") print("-" * 80)Note:DeepSeek models are accessed through the Groq API. The `deepseek-r1-distill-llama-70b` model includes reasoning tokens wrapped in `<think>` tags, which are removed in the example.
-
Run your DeepSeek application.
python3 deepseek_app.pyThe application will send questions to DeepSeek and display the responses. OpenLLMetry automatically captures traces for each API call and sends them to Instana.
-
View data on Instana.
After running your application, the following items are displayed on the Instana Gen AI observability dashboard:
- Model used
- Token usage (input and output tokens)
- Response latency
- Request and response content
Troubleshooting
For common issues such as traces not appearing or connection errors, see Troubleshooting.
Authentication errors
If you encounter authentication errors:
- Verify your
GROQ_API_KEYis set correctly - Check whether your API key is valid on Groq Console
- Make sure that your API key is not expired or revoked
Rate limiting errors
If you encounter rate limit errors:
- Check your Groq account's rate limits
- Add delays between requests if making multiple calls
- Consider upgrading your Groq plan for higher limits
- Implement exponential backoff for retries
Model not found errors
If you encounter model not found errors:
- Verify the model name is correct (for example,
deepseek-r1-distill-llama-70b) - Check whether the model is available through Groq3.
- For DeepSeek models, see groq
Next steps
- Explore Monitoring LLMs from model providers supported by Instana
- Learn about costs for your LLM usage
- Set up alerts for your DeepSeek API usage
- Review DeepSeek documentation for model capabilities