Open xiaoxiaoimg opened 5 hours ago
Hi @xiaoxiaoimg -- can you explain what you mean by this? The OpenAI library is supported and so are other BaseURLs. Can you post a code snippet demonstrating the bug?
I think I understand what he means - correct me if wrong.
You use a custom OpenAI-compatible endpoint and you're wondering whether AgentOps will support that, am I correct?
The answer is not currently, but it's an interesting idea and not though to make happen
This would mean us having to intercept:
Though I don't see this happening any time soon, it is not an integration but something you would develop yourself. To integrate with agentops "the hard way", checkout the decorators section from our docs.
I tried with OpenRouter and it seems to work for me
In [1]: from openai import OpenAI
...: import os
...: import agentops
...:
...: agentops.init(tags=["openrouter"])
...:
...: client = OpenAI(
...: base_url="https://openrouter.ai/api/v1",
...: api_key=os.environ.get('OPENROUTER_API_KEY'),
...: )
...:
...: completion = client.chat.completions.create(
...: model="openai/gpt-3.5-turbo",
...: messages=[
...: {
...: "role": "user",
...: "content": "What is the meaning of life?"
...: }
...: ]
...: )
...: print(completion.choices[0].message.content)
🖇 AgentOps: The 'tags' parameter is deprecated. Use 'default_tags' instead
🖇 AgentOps: WARNING: agentops is out of date. Please update with the command: 'pip install --upgrade agentops'
🖇 AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=8414c52a-c41c-4e7c-a795-c3d9f2c21bef
The meaning of life is a philosophical question that has been debated for centuries. Different cultures, religions, and individuals have different beliefs about the purpose and meaning of life. Some believe that the meaning of life is to seek happiness and fulfillment, others believe it is to achieve spiritual enlightenment or serve a higher power. Ultimately, the meaning of life is a deeply personal question that each individual must grapple with and come to their own conclusions about.
In [2]: agentops.end_session("Success")
🖇 AgentOps: Session Stats - Duration: 8.2s | Cost: $0.00 | LLMs: 1 | Tools: 0 | Actions: 0 | Errors: 0
🖇 AgentOps: Session Replay: https://app.agentops.ai/drilldown?session_id=8414c52a-c41c-4e7c-a795-c3d9f2c21bef
In [3]:
Contact Details
No response
📦 Package Version
0.3.17
🎞️ Framework Version
No response
🔎 Describe the Bug
Currently, AgenOps only supports openAI. Does AgenOps support other base_url?
🤝 Contribution