Skip to content

Commit fb55ada

Browse files
authored
Merge pull request #45 from Not-Diamond/release-please--branches--main--changes--next
release: 1.2.3
2 parents 64ab0cc + 20a9e46 commit fb55ada

13 files changed

Lines changed: 292 additions & 10 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ${{ github.repository == 'stainless-sdks/notdiamond-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v6
2323

2424
- name: Install Rye
2525
run: |
@@ -44,7 +44,7 @@ jobs:
4444
id-token: write
4545
runs-on: ${{ github.repository == 'stainless-sdks/notdiamond-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4646
steps:
47-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@v6
4848

4949
- name: Install Rye
5050
run: |
@@ -81,7 +81,7 @@ jobs:
8181
runs-on: ${{ github.repository == 'stainless-sdks/notdiamond-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
8282
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
8383
steps:
84-
- uses: actions/checkout@v4
84+
- uses: actions/checkout@v6
8585

8686
- name: Install Rye
8787
run: |

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1818

1919
- name: Install Rye
2020
run: |

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: github.repository == 'Not-Diamond/not-diamond-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616

1717
- name: Check release environment
1818
run: |

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.2.2"
2+
".": "1.3.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 9
1+
configured_endpoints: 10
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnotdiamond-6dcb958c22f012b6c5f0ee0d725db33e4a56091bc6761c9118f27c30974f103d.yml
33
openapi_spec_hash: 73db82e853bafec2908cd4ecb59731eb
4-
config_hash: ab855b9eb6783704bab1e5aab953b682
4+
config_hash: 9c352cd80df475575d184f0ab5ff21f2

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 1.3.0 (2026-01-17)
4+
5+
Full Changelog: [v1.2.2...v1.3.0](https://github.com/Not-Diamond/not-diamond-python/compare/v1.2.2...v1.3.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([4f5cbc8](https://github.com/Not-Diamond/not-diamond-python/commit/4f5cbc86230f35d5eaa7421e5c794fe037b32b92))
10+
11+
12+
### Chores
13+
14+
* **internal:** update `actions/checkout` version ([15211cd](https://github.com/Not-Diamond/not-diamond-python/commit/15211cd2310f289b894c358840e4c122fea68515))
15+
316
## 1.2.2 (2026-01-16)
417

518
Full Changelog: [v1.2.1...v1.2.2](https://github.com/Not-Diamond/not-diamond-python/compare/v1.2.1...v1.2.2)

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ from notdiamond.types import (
3636
PromptOptimizationGetOptimizationResultsResponse,
3737
PromptOptimizationGetOptimziationStatusResponse,
3838
PromptOptimizationOptimizeResponse,
39+
PromptOptimizationRetrieveCostsResponse,
3940
)
4041
```
4142

@@ -44,6 +45,7 @@ Methods:
4445
- <code title="get /v2/prompt/optimizeResults/{optimization_run_id}">client.prompt_optimization.<a href="./src/notdiamond/resources/prompt_optimization.py">get_optimization_results</a>(optimization_run_id) -> <a href="./src/notdiamond/types/prompt_optimization_get_optimization_results_response.py">PromptOptimizationGetOptimizationResultsResponse</a></code>
4546
- <code title="get /v2/prompt/optimizeStatus/{optimization_run_id}">client.prompt_optimization.<a href="./src/notdiamond/resources/prompt_optimization.py">get_optimziation_status</a>(optimization_run_id) -> <a href="./src/notdiamond/types/prompt_optimization_get_optimziation_status_response.py">PromptOptimizationGetOptimziationStatusResponse</a></code>
4647
- <code title="post /v2/prompt/optimize">client.prompt_optimization.<a href="./src/notdiamond/resources/prompt_optimization.py">optimize</a>(\*\*<a href="src/notdiamond/types/prompt_optimization_optimize_params.py">params</a>) -> <a href="./src/notdiamond/types/prompt_optimization_optimize_response.py">PromptOptimizationOptimizeResponse</a></code>
48+
- <code title="get /v2/prompt/optimize/{optimization_run_id}/costs">client.prompt_optimization.<a href="./src/notdiamond/resources/prompt_optimization.py">retrieve_costs</a>(optimization_run_id) -> <a href="./src/notdiamond/types/prompt_optimization_retrieve_costs_response.py">PromptOptimizationRetrieveCostsResponse</a></code>
4749

4850
# CustomRouter
4951

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "notdiamond"
3-
version = "1.2.2"
3+
version = "1.3.0"
44
description = "The official Python library for the notdiamond API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/notdiamond/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "notdiamond"
4-
__version__ = "1.2.2" # x-release-please-version
4+
__version__ = "1.3.0" # x-release-please-version

src/notdiamond/resources/prompt_optimization.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from ..types.golden_record_param import GoldenRecordParam
2222
from ..types.request_provider_param import RequestProviderParam
2323
from ..types.prompt_optimization_optimize_response import PromptOptimizationOptimizeResponse
24+
from ..types.prompt_optimization_retrieve_costs_response import PromptOptimizationRetrieveCostsResponse
2425
from ..types.prompt_optimization_get_optimziation_status_response import PromptOptimizationGetOptimziationStatusResponse
2526
from ..types.prompt_optimization_get_optimization_results_response import (
2627
PromptOptimizationGetOptimizationResultsResponse,
@@ -335,6 +336,56 @@ def optimize(
335336
cast_to=PromptOptimizationOptimizeResponse,
336337
)
337338

339+
def retrieve_costs(
340+
self,
341+
optimization_run_id: str,
342+
*,
343+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
344+
# The extra values given here take precedence over values defined on the client or passed to this method.
345+
extra_headers: Headers | None = None,
346+
extra_query: Query | None = None,
347+
extra_body: Body | None = None,
348+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
349+
) -> PromptOptimizationRetrieveCostsResponse:
350+
"""
351+
Get LLM usage costs for a specific prompt optimization run.
352+
353+
This endpoint returns the total cost and detailed usage records for all LLM
354+
requests made during a prompt optimization run. Use this to track costs
355+
associated with optimizing prompts for different target models.
356+
357+
**Cost Breakdown:**
358+
359+
- Total cost across all models used in the optimization
360+
- Individual usage records with provider, model, tokens, and costs
361+
- Timestamps for each LLM request
362+
363+
**Access Control:**
364+
365+
- Only accessible by the user who created the optimization run
366+
- Requires prompt optimization access
367+
368+
Args:
369+
extra_headers: Send extra headers
370+
371+
extra_query: Add additional query parameters to the request
372+
373+
extra_body: Add additional JSON properties to the request
374+
375+
timeout: Override the client-level default timeout for this request, in seconds
376+
"""
377+
if not optimization_run_id:
378+
raise ValueError(
379+
f"Expected a non-empty value for `optimization_run_id` but received {optimization_run_id!r}"
380+
)
381+
return self._get(
382+
f"/v2/prompt/optimize/{optimization_run_id}/costs",
383+
options=make_request_options(
384+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
385+
),
386+
cast_to=PromptOptimizationRetrieveCostsResponse,
387+
)
388+
338389

339390
class AsyncPromptOptimizationResource(AsyncAPIResource):
340391
@cached_property
@@ -642,6 +693,56 @@ async def optimize(
642693
cast_to=PromptOptimizationOptimizeResponse,
643694
)
644695

696+
async def retrieve_costs(
697+
self,
698+
optimization_run_id: str,
699+
*,
700+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
701+
# The extra values given here take precedence over values defined on the client or passed to this method.
702+
extra_headers: Headers | None = None,
703+
extra_query: Query | None = None,
704+
extra_body: Body | None = None,
705+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
706+
) -> PromptOptimizationRetrieveCostsResponse:
707+
"""
708+
Get LLM usage costs for a specific prompt optimization run.
709+
710+
This endpoint returns the total cost and detailed usage records for all LLM
711+
requests made during a prompt optimization run. Use this to track costs
712+
associated with optimizing prompts for different target models.
713+
714+
**Cost Breakdown:**
715+
716+
- Total cost across all models used in the optimization
717+
- Individual usage records with provider, model, tokens, and costs
718+
- Timestamps for each LLM request
719+
720+
**Access Control:**
721+
722+
- Only accessible by the user who created the optimization run
723+
- Requires prompt optimization access
724+
725+
Args:
726+
extra_headers: Send extra headers
727+
728+
extra_query: Add additional query parameters to the request
729+
730+
extra_body: Add additional JSON properties to the request
731+
732+
timeout: Override the client-level default timeout for this request, in seconds
733+
"""
734+
if not optimization_run_id:
735+
raise ValueError(
736+
f"Expected a non-empty value for `optimization_run_id` but received {optimization_run_id!r}"
737+
)
738+
return await self._get(
739+
f"/v2/prompt/optimize/{optimization_run_id}/costs",
740+
options=make_request_options(
741+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
742+
),
743+
cast_to=PromptOptimizationRetrieveCostsResponse,
744+
)
745+
645746

646747
class PromptOptimizationResourceWithRawResponse:
647748
def __init__(self, prompt_optimization: PromptOptimizationResource) -> None:
@@ -656,6 +757,9 @@ def __init__(self, prompt_optimization: PromptOptimizationResource) -> None:
656757
self.optimize = to_raw_response_wrapper(
657758
prompt_optimization.optimize,
658759
)
760+
self.retrieve_costs = to_raw_response_wrapper(
761+
prompt_optimization.retrieve_costs,
762+
)
659763

660764

661765
class AsyncPromptOptimizationResourceWithRawResponse:
@@ -671,6 +775,9 @@ def __init__(self, prompt_optimization: AsyncPromptOptimizationResource) -> None
671775
self.optimize = async_to_raw_response_wrapper(
672776
prompt_optimization.optimize,
673777
)
778+
self.retrieve_costs = async_to_raw_response_wrapper(
779+
prompt_optimization.retrieve_costs,
780+
)
674781

675782

676783
class PromptOptimizationResourceWithStreamingResponse:
@@ -686,6 +793,9 @@ def __init__(self, prompt_optimization: PromptOptimizationResource) -> None:
686793
self.optimize = to_streamed_response_wrapper(
687794
prompt_optimization.optimize,
688795
)
796+
self.retrieve_costs = to_streamed_response_wrapper(
797+
prompt_optimization.retrieve_costs,
798+
)
689799

690800

691801
class AsyncPromptOptimizationResourceWithStreamingResponse:
@@ -701,3 +811,6 @@ def __init__(self, prompt_optimization: AsyncPromptOptimizationResource) -> None
701811
self.optimize = async_to_streamed_response_wrapper(
702812
prompt_optimization.optimize,
703813
)
814+
self.retrieve_costs = async_to_streamed_response_wrapper(
815+
prompt_optimization.retrieve_costs,
816+
)

0 commit comments

Comments
 (0)