agentops icon indicating copy to clipboard operation
agentops copied to clipboard

[Question]: Currently, AgenOps only supports openAI. Does AgenOps support other base_url?

Open xiaoxiaoimg opened this issue 1 year ago • 4 comments

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

  • [ ] Yes, I'd be happy to submit a pull request with these changes.
  • [ ] I need some guidance on how to contribute.
  • [ ] I'd prefer the AgentOps team to handle this update.

xiaoxiaoimg avatar Nov 20 '24 02:11 xiaoxiaoimg

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?

areibman avatar Nov 20 '24 04:11 areibman

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:

  • Requests
  • httpx
  • urllib3
  • aiohttp
  • http.client

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.

teocns avatar Nov 20 '24 05:11 teocns

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]:
image

areibman avatar Nov 20 '24 06:11 areibman

Bumping! @xiaoxiaoimg

areibman avatar Nov 25 '24 18:11 areibman

Stale (AgentOps does support other base_url)

Dwij1704 avatar Jul 15 '25 22:07 Dwij1704