How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.29.1
Steps to Reproduce
When you call:
from anthropic import AsyncAnthropicVertex, omit
client = AsyncAnthropicVertex()
client.messages.create(
max_tokens=max_answer_tokens,
system=prompt if user_input else omit,
messages=[
{
"role": "user",
"content": user_input if user_input else prompt,
}
],
model=model,
tools=omit,
stream=True,
)
You get an error: "object of type 'Omit' has no len()"
The error comes from here:
https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/anthropic.py#L174-L179
Both Anthropic and OpenAI latest version defaults to Omit instead of NOT_GIVEN:
https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/resources/messages/messages.py#L357-L380
We saw some similar errors in OpenAI that might be related: NotGiven has no len()
Expected Result
Both Anthropic and OpenAI shouldn't raise when we pass the argument as Omit
Actual Result
Anthropic and OpenAI are raising when we pass the argument as Omit
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.29.1
Steps to Reproduce
When you call:
You get an error:
"object of type 'Omit' has no len()"The error comes from here:
https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/anthropic.py#L174-L179
Both Anthropic and OpenAI latest version defaults to Omit instead of NOT_GIVEN:
https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/resources/messages/messages.py#L357-L380
We saw some similar errors in OpenAI that might be related:
NotGiven has no len()Expected Result
Both Anthropic and OpenAI shouldn't raise when we pass the argument as Omit
Actual Result
Anthropic and OpenAI are raising when we pass the argument as Omit