-
Notifications
You must be signed in to change notification settings - Fork 80
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
add upset examples multipart endpoint #1209
base: main
Are you sure you want to change the base?
Conversation
python/langsmith/client.py
Outdated
if encoder.len <= 20_000_000: # ~20 MB | ||
data = encoder.to_string() | ||
else: | ||
data = encoder | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this is what we do for runs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this code was copy pasted
python/langsmith/client.py
Outdated
def upsert_examples_multipart( | ||
self, | ||
*, | ||
upserts: List[ls_schemas.ExampleCreateWithAttachments] = [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not initialize this to empty list due to the way python handles mutable default arguments, see here https://nikos7am.com/posts/mutable-default-arguments/
to fix, just remove the default
python/langsmith/client.py
Outdated
if not isinstance(upserts, list): | ||
raise TypeError(f"upserts must be a list, got {type(upserts)}") | ||
for item in upserts: | ||
if not isinstance(item, ls_schemas.ExampleCreateWithAttachments): | ||
raise TypeError(f"Each item must be ExampleCreateWithAttachments, got {type(item)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessary, we don't check types like this elsewhere
) | ||
|
||
with pytest.raises(LangSmithNotFoundError): | ||
langchain_client.upsert_examples_multipart(upserts=[example_3]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why should this raise a not found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it can't find the dataset I believe
Co-authored-by: Ankush Gola <[email protected]>
No description provided.