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

(fix) Pass subject with correct value to OpenMeter in OpenMeter integration #6816

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

togmund
Copy link

@togmund togmund commented Nov 19, 2024

Title

OpenMeter rejects requests from this logger here:

try:
await self.async_http_handler.post(
url=_url,
data=json.dumps(_data),
headers=_headers,
)
except httpx.HTTPStatusError as e:
raise Exception(f"OpenMeter logging error: {e.response.text}")

Because the value of subject is not a string. See schema here.

This is because instead of assigning the subject property with the value of the user param in kwargs, it is instead wrapping that value in a tuple:

subject = (kwargs.get("user", None),) # end-user passed in via 'user' param

Relevant issues

N/A

Type

🐛 Bug Fix

Changes

  • Assign subject with the value of the user param, rather than as a tuple containing the value of the user param.

[REQUIRED] Testing - Attach a screenshot of any new tests passing locally

If UI changes, send a screenshot/GIF of working UI fixes

  • Set up OpenMeter according to the docs
  • Observe the OpenMeter rejection responses without the changes
  • Observe the OpenMeter success responses with the changes

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 9:38pm

@togmund togmund changed the title Fix: Assign subject with the value of the user param, rather than as a tuple containing the value of the user param. Fix: Pass subject with correct value to OpenMeter in OpenMeter integration Nov 19, 2024
@togmund togmund changed the title Fix: Pass subject with correct value to OpenMeter in OpenMeter integration (fix) Pass subject with correct value to OpenMeter in OpenMeter integration Nov 19, 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

Successfully merging this pull request may close these issues.

1 participant