Skip to content

Commit f402cad

Browse files
feat(api): api update
1 parent fdb4753 commit f402cad

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 43
2-
openapi_spec_hash: 6d2d01f4951c677a47cffe973084413e
2+
openapi_spec_hash: 3873591605b529e6ae298fc7f04d4ba1
33
config_hash: 5e459b33c53ffa6e554087a779bdb790

src/codex/resources/projects/entries.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def query(
319319
question: str,
320320
use_llm_matching: bool | NotGiven = NOT_GIVEN,
321321
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
322+
query_metadata: Optional[entry_query_params.QueryMetadata] | NotGiven = NOT_GIVEN,
322323
x_client_library_version: str | NotGiven = NOT_GIVEN,
323324
x_integration_type: str | NotGiven = NOT_GIVEN,
324325
x_source: str | NotGiven = NOT_GIVEN,
@@ -334,6 +335,10 @@ def query(
334335
Query Entries Route
335336
336337
Args:
338+
client_metadata: Deprecated: Use query_metadata instead
339+
340+
query_metadata: Optional logging data that can be provided by the client.
341+
337342
extra_headers: Send extra headers
338343
339344
extra_query: Add additional query parameters to the request
@@ -361,6 +366,7 @@ def query(
361366
{
362367
"question": question,
363368
"client_metadata": client_metadata,
369+
"query_metadata": query_metadata,
364370
},
365371
entry_query_params.EntryQueryParams,
366372
),
@@ -708,6 +714,7 @@ async def query(
708714
question: str,
709715
use_llm_matching: bool | NotGiven = NOT_GIVEN,
710716
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
717+
query_metadata: Optional[entry_query_params.QueryMetadata] | NotGiven = NOT_GIVEN,
711718
x_client_library_version: str | NotGiven = NOT_GIVEN,
712719
x_integration_type: str | NotGiven = NOT_GIVEN,
713720
x_source: str | NotGiven = NOT_GIVEN,
@@ -723,6 +730,10 @@ async def query(
723730
Query Entries Route
724731
725732
Args:
733+
client_metadata: Deprecated: Use query_metadata instead
734+
735+
query_metadata: Optional logging data that can be provided by the client.
736+
726737
extra_headers: Send extra headers
727738
728739
extra_query: Add additional query parameters to the request
@@ -750,6 +761,7 @@ async def query(
750761
{
751762
"question": question,
752763
"client_metadata": client_metadata,
764+
"query_metadata": query_metadata,
753765
},
754766
entry_query_params.EntryQueryParams,
755767
),

src/codex/types/projects/entry_query_params.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Dict, List, Union, Iterable, Optional
66
from typing_extensions import Required, Annotated, TypedDict
77

88
from ..._utils import PropertyInfo
99

10-
__all__ = ["EntryQueryParams"]
10+
__all__ = ["EntryQueryParams", "QueryMetadata", "QueryMetadataContextUnionMember3"]
1111

1212

1313
class EntryQueryParams(TypedDict, total=False):
@@ -16,6 +16,10 @@ class EntryQueryParams(TypedDict, total=False):
1616
use_llm_matching: bool
1717

1818
client_metadata: Optional[object]
19+
"""Deprecated: Use query_metadata instead"""
20+
21+
query_metadata: Optional[QueryMetadata]
22+
"""Optional logging data that can be provided by the client."""
1923

2024
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
2125

@@ -24,3 +28,34 @@ class EntryQueryParams(TypedDict, total=False):
2428
x_source: Annotated[str, PropertyInfo(alias="x-source")]
2529

2630
x_stainless_package_version: Annotated[str, PropertyInfo(alias="x-stainless-package-version")]
31+
32+
33+
class QueryMetadataContextUnionMember3(TypedDict, total=False):
34+
content: Required[str]
35+
"""The actual content/text of the document."""
36+
37+
id: Optional[str]
38+
"""Unique identifier for the document. Useful for tracking documents"""
39+
40+
source: Optional[str]
41+
"""Source or origin of the document. Useful for citations."""
42+
43+
tags: Optional[List[str]]
44+
"""Tags or categories for the document. Useful for filtering"""
45+
46+
title: Optional[str]
47+
"""Title or heading of the document. Useful for display and context."""
48+
49+
50+
class QueryMetadata(TypedDict, total=False):
51+
context: Union[str, List[str], Iterable[object], Iterable[QueryMetadataContextUnionMember3], None]
52+
"""RAG context used for the query"""
53+
54+
custom_metadata: Optional[object]
55+
"""Arbitrary metadata supplied by the user/system"""
56+
57+
eval_scores: Optional[Dict[str, float]]
58+
"""Evaluation scores for the original response"""
59+
60+
evaluated_response: Optional[str]
61+
"""The response being evaluated from the RAG system(before any remediation)"""

tests/api_resources/projects/test_entries.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,12 @@ def test_method_query_with_all_params(self, client: Codex) -> None:
396396
question="question",
397397
use_llm_matching=True,
398398
client_metadata={},
399+
query_metadata={
400+
"context": "string",
401+
"custom_metadata": {},
402+
"eval_scores": {"foo": 0},
403+
"evaluated_response": "evaluated_response",
404+
},
399405
x_client_library_version="x-client-library-version",
400406
x_integration_type="x-integration-type",
401407
x_source="x-source",
@@ -871,6 +877,12 @@ async def test_method_query_with_all_params(self, async_client: AsyncCodex) -> N
871877
question="question",
872878
use_llm_matching=True,
873879
client_metadata={},
880+
query_metadata={
881+
"context": "string",
882+
"custom_metadata": {},
883+
"eval_scores": {"foo": 0},
884+
"evaluated_response": "evaluated_response",
885+
},
874886
x_client_library_version="x-client-library-version",
875887
x_integration_type="x-integration-type",
876888
x_source="x-source",

0 commit comments

Comments
 (0)