Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
xiaoxiaoimg opened this issue Nov 20, 2024 · 4 comments

Comments

@xiaoxiaoimg
Copy link

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 xiaoxiaoimg added the bug Something isn't working label Nov 20, 2024
@areibman
Copy link
Contributor

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?

@teocns
Copy link
Contributor

teocns commented Nov 20, 2024

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 teocns added question Further information is requested and removed bug Something isn't working labels Nov 20, 2024
@teocns teocns changed the title [Bug]: Currently, AgenOps only supports openAI. Does AgenOps support other base_url? [Question]: Currently, AgenOps only supports openAI. Does AgenOps support other base_url? Nov 20, 2024
@teocns teocns closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
@areibman
Copy link
Contributor

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 areibman reopened this Nov 20, 2024
@areibman
Copy link
Contributor

Bumping! @xiaoxiaoimg

@areibman areibman removed the question Further information is requested label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants