-
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
fix: pushing new manifest without metadata update #907
Conversation
python/langsmith/client.py
Outdated
@@ -5036,7 +5036,7 @@ def create_prompt( | |||
description: Optional[str] = None, | |||
readme: Optional[str] = None, | |||
tags: Optional[Sequence[str]] = None, | |||
is_public: bool = False, | |||
is_public: Optional[bool] = False, |
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.
what's the need for this? / does "none" mean anything diff than false?
python/langsmith/client.py
Outdated
tags=tags, | ||
is_public=is_public, | ||
) | ||
if not ( |
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.
nit: easier to read if we flip the conditions:
if (all this stuff is none) then create prompt, else update
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.
we still need to do this check after checking if prompt exists because if prompt doesnt' exist we just want to create it
if prompt exists AND none of these things are set, skip the call to update prompt
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 just saying it's hard to read a double negative (not x is None vs. if x); the logic is right.
I find both of the following easier to read:
if any(
parent_commit_hash is None
and is_public is None
and description is None
and readme is None
and tags is None
):
self.create_prompt(
prompt_identifier,
is_public=is_public,
description=description,
readme=readme,
tags=tags,
)
else:
self.update_prompt(
prompt_identifier,
description=description,
readme=readme,
tags=tags,
is_public=is_public,
)
or
if any (
parent_commit_hash is not None
and is_public is not None
and description is not None
and readme is not None
and tags is not None
):
self.update_prompt(
prompt_identifier,
description=description,
readme=readme,
tags=tags,
is_public=is_public,
)
else:
self.create_prompt(
prompt_identifier,
is_public=is_public,
description=description,
readme=readme,
tags=tags,
)
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.
Awesome!
When pushing an updated manifest to an existing prompt and not specifying any other options, update_prompt threw an error that we need to be updating something, but we're updating the manifest. This fixes.