-
Notifications
You must be signed in to change notification settings - Fork 87
Add Prompt dataclass with initial methods (JUD-2082) #562
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
Merged
Parent:
Staging -> Main
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
90cfb2c
Add Prompt dataclass with initial methods
adivate2021 a7e2803
initial changes
justinsheu a82f167
Merge branch 'staging' into aaryan/add-prompt-management
justinsheu 8bd2173
Merge branch 'staging' into aaryan/add-prompt-management
justinsheu d2d8dcb
response type change
justinsheu 2a99789
add e2e tests
justinsheu 419370e
update types
justinsheu 58a2848
Merge branch 'staging' into aaryan/add-prompt-management
justinsheu 9be3be3
small fixes
justinsheu aab38de
add api key and org id params to Prompt interface
justinsheu 4ab4ab7
fix tests
justinsheu a187cac
add test
justinsheu 70b72ee
created_at is now part of Prompt instead of metadata
justinsheu aedef4e
return creator email
justinsheu 16880a9
Merge branch 'staging' into aaryan/add-prompt-management, also fixes
justinsheu 2b0a525
update types
justinsheu f7b138d
remove print
justinsheu 3e91c47
more fixes
justinsheu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,69 @@ def upload_custom_scorer( | |
| payload, | ||
| ) | ||
|
|
||
| def prompts_insert(self, payload: PromptInsertRequest) -> PromptInsertResponse: | ||
| return self._request( | ||
| "POST", | ||
| url_for("/prompts/insert/"), | ||
| payload, | ||
| ) | ||
|
|
||
| def prompts_tag(self, payload: PromptTagRequest) -> PromptTagResponse: | ||
| return self._request( | ||
| "POST", | ||
| url_for("/prompts/tag/"), | ||
| payload, | ||
| ) | ||
|
|
||
| def prompts_untag(self, payload: PromptUntagRequest) -> PromptUntagResponse: | ||
| return self._request( | ||
| "POST", | ||
| url_for("/prompts/untag/"), | ||
| payload, | ||
| ) | ||
|
|
||
| def prompts_fetch( | ||
| self, | ||
| name: str, | ||
| project_name: Optional[str] = None, | ||
| project_id: Optional[str] = None, | ||
| commit_id: Optional[str] = None, | ||
| tag: Optional[str] = None, | ||
| ) -> PromptFetchResponse: | ||
| query_params = {} | ||
| if project_name is not None: | ||
| query_params["project_name"] = project_name | ||
| if project_id is not None: | ||
| query_params["project_id"] = project_id | ||
| query_params["name"] = name | ||
| if commit_id is not None: | ||
| query_params["commit_id"] = commit_id | ||
| if tag is not None: | ||
| query_params["tag"] = tag | ||
| return self._request( | ||
| "GET", | ||
| url_for("/prompts/fetch/"), | ||
| query_params, | ||
| ) | ||
propel-code-bot[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def prompts_get_prompt_versions( | ||
| self, | ||
| name: str, | ||
| project_id: Optional[str] = None, | ||
|
||
| project_name: Optional[str] = None, | ||
| ) -> PromptVersionsResponse: | ||
| query_params = {} | ||
| if project_id is not None: | ||
| query_params["project_id"] = project_id | ||
| if project_name is not None: | ||
| query_params["project_name"] = project_name | ||
| query_params["name"] = name | ||
| return self._request( | ||
| "GET", | ||
| url_for("/prompts/get_prompt_versions/"), | ||
| query_params, | ||
| ) | ||
propel-code-bot[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def projects_resolve( | ||
| self, payload: ResolveProjectNameRequest | ||
| ) -> ResolveProjectNameResponse: | ||
|
|
@@ -381,6 +444,71 @@ async def upload_custom_scorer( | |
| payload, | ||
| ) | ||
|
|
||
| async def prompts_insert( | ||
| self, payload: PromptInsertRequest | ||
| ) -> PromptInsertResponse: | ||
| return await self._request( | ||
| "POST", | ||
| url_for("/prompts/insert/"), | ||
| payload, | ||
| ) | ||
|
|
||
| async def prompts_tag(self, payload: PromptTagRequest) -> PromptTagResponse: | ||
| return await self._request( | ||
| "POST", | ||
| url_for("/prompts/tag/"), | ||
| payload, | ||
| ) | ||
|
|
||
| async def prompts_untag(self, payload: PromptUntagRequest) -> PromptUntagResponse: | ||
| return await self._request( | ||
| "POST", | ||
| url_for("/prompts/untag/"), | ||
| payload, | ||
| ) | ||
|
|
||
| async def prompts_fetch( | ||
| self, | ||
| name: str, | ||
| project_name: Optional[str] = None, | ||
| project_id: Optional[str] = None, | ||
| commit_id: Optional[str] = None, | ||
| tag: Optional[str] = None, | ||
| ) -> PromptFetchResponse: | ||
| query_params = {} | ||
| if project_name is not None: | ||
| query_params["project_name"] = project_name | ||
| if project_id is not None: | ||
| query_params["project_id"] = project_id | ||
| query_params["name"] = name | ||
| if commit_id is not None: | ||
| query_params["commit_id"] = commit_id | ||
| if tag is not None: | ||
| query_params["tag"] = tag | ||
| return await self._request( | ||
| "GET", | ||
| url_for("/prompts/fetch/"), | ||
| query_params, | ||
| ) | ||
propel-code-bot[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| async def prompts_get_prompt_versions( | ||
| self, | ||
| name: str, | ||
| project_id: Optional[str] = None, | ||
| project_name: Optional[str] = None, | ||
| ) -> PromptVersionsResponse: | ||
| query_params = {} | ||
| if project_id is not None: | ||
| query_params["project_id"] = project_id | ||
| if project_name is not None: | ||
| query_params["project_name"] = project_name | ||
| query_params["name"] = name | ||
| return await self._request( | ||
| "GET", | ||
| url_for("/prompts/get_prompt_versions/"), | ||
| query_params, | ||
| ) | ||
propel-code-bot[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| async def projects_resolve( | ||
| self, payload: ResolveProjectNameRequest | ||
| ) -> ResolveProjectNameResponse: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 does this require both? can we make the server endpoint only require project_Id? and we can resolve it locally and cache it once.
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.
also can we make project_id only not optional