From 763a8049cc46262c50a37dbe68d67eda843da2b8 Mon Sep 17 00:00:00 2001 From: robot-ci-heartex <87703623+robot-ci-heartex@users.noreply.github.com> Date: Wed, 2 Oct 2024 03:04:30 +0400 Subject: [PATCH] feat: DIA-1402: V1-Submit Prompt auto-refinement job (#322) Co-authored-by: Matt Bernstein Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> --- .mock/definition/prompts/versions.yml | 6 +++--- poetry.lock | 8 ++++---- reference.md | 4 ++-- src/label_studio_sdk/prompts/versions/client.py | 16 ++++++++-------- tests/prompts/test_versions.py | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.mock/definition/prompts/versions.yml b/.mock/definition/prompts/versions.yml index 77b8f4da4..4e0df35d4 100644 --- a/.mock/definition/prompts/versions.yml +++ b/.mock/definition/prompts/versions.yml @@ -163,14 +163,14 @@ service: audiences: - public refine_prompt: - path: /api/prompts/{id}/versions/{version_id}/refine-prompt + path: /api/prompts/{prompt_id}/versions/{version_id}/refine method: POST auth: true docs: > Refine a prompt version using a teacher model and save the refined prompt as a new version. path-parameters: - id: + prompt_id: type: integer docs: Prompt ID version_id: @@ -195,7 +195,7 @@ service: type: root.PromptVersion examples: - path-parameters: - id: 1 + prompt_id: 1 version_id: 1 request: {} response: diff --git a/poetry.lock b/poetry.lock index 9e1257ee2..864798fe0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -228,13 +228,13 @@ files = [ [[package]] name = "httpcore" -version = "1.0.5" +version = "1.0.6" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpcore-1.0.5-py3-none-any.whl", hash = "sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5"}, - {file = "httpcore-1.0.5.tar.gz", hash = "sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61"}, + {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, + {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, ] [package.dependencies] @@ -245,7 +245,7 @@ h11 = ">=0.13,<0.15" asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] -trio = ["trio (>=0.22.0,<0.26.0)"] +trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" diff --git a/reference.md b/reference.md index 01dc90878..456ca2b4d 100644 --- a/reference.md +++ b/reference.md @@ -15198,7 +15198,7 @@ client = LabelStudio( api_key="YOUR_API_KEY", ) client.prompts.versions.refine_prompt( - id=1, + prompt_id=1, version_id=1, ) @@ -15216,7 +15216,7 @@ client.prompts.versions.refine_prompt(
-**id:** `int` — Prompt ID +**prompt_id:** `int` — Prompt ID
diff --git a/src/label_studio_sdk/prompts/versions/client.py b/src/label_studio_sdk/prompts/versions/client.py index e2b45469c..c0c65062d 100644 --- a/src/label_studio_sdk/prompts/versions/client.py +++ b/src/label_studio_sdk/prompts/versions/client.py @@ -337,7 +337,7 @@ def update( def refine_prompt( self, - id: int, + prompt_id: int, version_id: int, *, teacher_model_provider_connection_id: typing.Optional[int] = OMIT, @@ -350,7 +350,7 @@ def refine_prompt( Parameters ---------- - id : int + prompt_id : int Prompt ID version_id : int @@ -381,12 +381,12 @@ def refine_prompt( api_key="YOUR_API_KEY", ) client.prompts.versions.refine_prompt( - id=1, + prompt_id=1, version_id=1, ) """ _response = self._client_wrapper.httpx_client.request( - f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/refine-prompt", + f"api/prompts/{jsonable_encoder(prompt_id)}/versions/{jsonable_encoder(version_id)}/refine", method="POST", json={ "teacher_model_provider_connection_id": teacher_model_provider_connection_id, @@ -728,7 +728,7 @@ async def update( async def refine_prompt( self, - id: int, + prompt_id: int, version_id: int, *, teacher_model_provider_connection_id: typing.Optional[int] = OMIT, @@ -741,7 +741,7 @@ async def refine_prompt( Parameters ---------- - id : int + prompt_id : int Prompt ID version_id : int @@ -772,12 +772,12 @@ async def refine_prompt( api_key="YOUR_API_KEY", ) await client.prompts.versions.refine_prompt( - id=1, + prompt_id=1, version_id=1, ) """ _response = await self._client_wrapper.httpx_client.request( - f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/refine-prompt", + f"api/prompts/{jsonable_encoder(prompt_id)}/versions/{jsonable_encoder(version_id)}/refine", method="POST", json={ "teacher_model_provider_connection_id": teacher_model_provider_connection_id, diff --git a/tests/prompts/test_versions.py b/tests/prompts/test_versions.py index a4b86b7d4..585e5a9c9 100644 --- a/tests/prompts/test_versions.py +++ b/tests/prompts/test_versions.py @@ -174,8 +174,8 @@ async def test_refine_prompt(client: LabelStudio, async_client: AsyncLabelStudio "updated_at": "datetime", "organization": "integer", } - response = client.prompts.versions.refine_prompt(id=1, version_id=1) + response = client.prompts.versions.refine_prompt(prompt_id=1, version_id=1) validate_response(response, expected_response, expected_types) - async_response = await async_client.prompts.versions.refine_prompt(id=1, version_id=1) + async_response = await async_client.prompts.versions.refine_prompt(prompt_id=1, version_id=1) validate_response(async_response, expected_response, expected_types)