Skip to content

Commit 2024a46

Browse files
feat(api): update via SDK Studio
1 parent 7be555f commit 2024a46

17 files changed

Lines changed: 336 additions & 371 deletions

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 52
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-17bdb8a33fb4fcade827bba868bd65cd30c64b1d09b4a6d83c3e37a8439ed37f.yml
33
openapi_spec_hash: bc325b52f3b20d8c56e0be5de88f2dc3
4-
config_hash: f0c8dfba598e8ad313dc6b95c7b34df6
4+
config_hash: 1ecef0ff4fd125bbc00eec65e3dd4798

api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ Types:
5050
```python
5151
from contextual.types import (
5252
Agent,
53+
AgentConfigs,
5354
AgentMetadata,
5455
CreateAgentOutput,
56+
FilterAndRerankConfig,
57+
GenerateResponseConfig,
58+
GlobalConfig,
5559
ListAgentsResponse,
60+
RetrievalConfig,
5661
AgentUpdateResponse,
5762
AgentDeleteResponse,
5863
AgentMetadataResponse,

src/contextual/resources/agents/agents.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
EvaluateResourceWithStreamingResponse,
5353
AsyncEvaluateResourceWithStreamingResponse,
5454
)
55+
from ...types.agent_configs_param import AgentConfigsParam
5556
from ...types.create_agent_output import CreateAgentOutput
5657
from ...types.agent_metadata_response import AgentMetadataResponse
5758

@@ -98,7 +99,7 @@ def create(
9899
self,
99100
*,
100101
name: str,
101-
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
102+
agent_configs: AgentConfigsParam | NotGiven = NOT_GIVEN,
102103
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
103104
description: str | NotGiven = NOT_GIVEN,
104105
filter_prompt: str | NotGiven = NOT_GIVEN,
@@ -186,7 +187,7 @@ def update(
186187
self,
187188
agent_id: str,
188189
*,
189-
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
190+
agent_configs: AgentConfigsParam | NotGiven = NOT_GIVEN,
190191
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
191192
filter_prompt: str | NotGiven = NOT_GIVEN,
192193
llm_model_id: str | NotGiven = NOT_GIVEN,
@@ -464,7 +465,7 @@ async def create(
464465
self,
465466
*,
466467
name: str,
467-
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
468+
agent_configs: AgentConfigsParam | NotGiven = NOT_GIVEN,
468469
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
469470
description: str | NotGiven = NOT_GIVEN,
470471
filter_prompt: str | NotGiven = NOT_GIVEN,
@@ -552,7 +553,7 @@ async def update(
552553
self,
553554
agent_id: str,
554555
*,
555-
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
556+
agent_configs: AgentConfigsParam | NotGiven = NOT_GIVEN,
556557
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
557558
filter_prompt: str | NotGiven = NOT_GIVEN,
558559
llm_model_id: str | NotGiven = NOT_GIVEN,

src/contextual/types/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,22 @@
44

55
from .agent import Agent as Agent
66
from .datastore import Datastore as Datastore
7+
from .agent_configs import AgentConfigs as AgentConfigs
8+
from .global_config import GlobalConfig as GlobalConfig
79
from .agent_metadata import AgentMetadata as AgentMetadata
810
from .new_user_param import NewUserParam as NewUserParam
11+
from .retrieval_config import RetrievalConfig as RetrievalConfig
912
from .user_list_params import UserListParams as UserListParams
1013
from .agent_list_params import AgentListParams as AgentListParams
1114
from .parse_jobs_params import ParseJobsParams as ParseJobsParams
1215
from .datastore_metadata import DatastoreMetadata as DatastoreMetadata
1316
from .user_invite_params import UserInviteParams as UserInviteParams
1417
from .user_update_params import UserUpdateParams as UserUpdateParams
18+
from .agent_configs_param import AgentConfigsParam as AgentConfigsParam
1519
from .agent_create_params import AgentCreateParams as AgentCreateParams
1620
from .agent_update_params import AgentUpdateParams as AgentUpdateParams
1721
from .create_agent_output import CreateAgentOutput as CreateAgentOutput
22+
from .global_config_param import GlobalConfigParam as GlobalConfigParam
1823
from .list_users_response import ListUsersResponse as ListUsersResponse
1924
from .parse_create_params import ParseCreateParams as ParseCreateParams
2025
from .parse_jobs_response import ParseJobsResponse as ParseJobsResponse
@@ -27,12 +32,17 @@
2732
from .generate_create_params import GenerateCreateParams as GenerateCreateParams
2833
from .lmunit_create_response import LMUnitCreateResponse as LMUnitCreateResponse
2934
from .rerank_create_response import RerankCreateResponse as RerankCreateResponse
35+
from .retrieval_config_param import RetrievalConfigParam as RetrievalConfigParam
3036
from .user_deactivate_params import UserDeactivateParams as UserDeactivateParams
3137
from .agent_metadata_response import AgentMetadataResponse as AgentMetadataResponse
3238
from .datastore_create_params import DatastoreCreateParams as DatastoreCreateParams
39+
from .filter_and_rerank_config import FilterAndRerankConfig as FilterAndRerankConfig
3340
from .generate_create_response import GenerateCreateResponse as GenerateCreateResponse
41+
from .generate_response_config import GenerateResponseConfig as GenerateResponseConfig
3442
from .list_datastores_response import ListDatastoresResponse as ListDatastoresResponse
3543
from .parse_job_results_params import ParseJobResultsParams as ParseJobResultsParams
3644
from .create_datastore_response import CreateDatastoreResponse as CreateDatastoreResponse
3745
from .parse_job_status_response import ParseJobStatusResponse as ParseJobStatusResponse
3846
from .parse_job_results_response import ParseJobResultsResponse as ParseJobResultsResponse
47+
from .filter_and_rerank_config_param import FilterAndRerankConfigParam as FilterAndRerankConfigParam
48+
from .generate_response_config_param import GenerateResponseConfigParam as GenerateResponseConfigParam
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
5+
from .._models import BaseModel
6+
from .global_config import GlobalConfig
7+
from .retrieval_config import RetrievalConfig
8+
from .filter_and_rerank_config import FilterAndRerankConfig
9+
from .generate_response_config import GenerateResponseConfig
10+
11+
__all__ = ["AgentConfigs"]
12+
13+
14+
class AgentConfigs(BaseModel):
15+
filter_and_rerank_config: Optional[FilterAndRerankConfig] = None
16+
"""Parameters that affect filtering and reranking of retrieved knowledge"""
17+
18+
generate_response_config: Optional[GenerateResponseConfig] = None
19+
"""Parameters that affect response generation"""
20+
21+
global_config: Optional[GlobalConfig] = None
22+
"""Parameters that affect the agent's overall RAG workflow"""
23+
24+
retrieval_config: Optional[RetrievalConfig] = None
25+
"""Parameters that affect how the agent retrieves from datastore(s)"""
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
from .global_config_param import GlobalConfigParam
8+
from .retrieval_config_param import RetrievalConfigParam
9+
from .filter_and_rerank_config_param import FilterAndRerankConfigParam
10+
from .generate_response_config_param import GenerateResponseConfigParam
11+
12+
__all__ = ["AgentConfigsParam"]
13+
14+
15+
class AgentConfigsParam(TypedDict, total=False):
16+
filter_and_rerank_config: FilterAndRerankConfigParam
17+
"""Parameters that affect filtering and reranking of retrieved knowledge"""
18+
19+
generate_response_config: GenerateResponseConfigParam
20+
"""Parameters that affect response generation"""
21+
22+
global_config: GlobalConfigParam
23+
"""Parameters that affect the agent's overall RAG workflow"""
24+
25+
retrieval_config: RetrievalConfigParam
26+
"""Parameters that affect how the agent retrieves from datastore(s)"""

src/contextual/types/agent_create_params.py

Lines changed: 4 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,16 @@
55
from typing import List
66
from typing_extensions import Required, TypedDict
77

8-
__all__ = [
9-
"AgentCreateParams",
10-
"AgentConfigs",
11-
"AgentConfigsFilterAndRerankConfig",
12-
"AgentConfigsGenerateResponseConfig",
13-
"AgentConfigsGlobalConfig",
14-
"AgentConfigsRetrievalConfig",
15-
]
8+
from .agent_configs_param import AgentConfigsParam
9+
10+
__all__ = ["AgentCreateParams"]
1611

1712

1813
class AgentCreateParams(TypedDict, total=False):
1914
name: Required[str]
2015
"""Name of the agent"""
2116

22-
agent_configs: AgentConfigs
17+
agent_configs: AgentConfigsParam
2318
"""The following advanced parameters are experimental and subject to change."""
2419

2520
datastore_ids: List[str]
@@ -54,116 +49,3 @@ class AgentCreateParams(TypedDict, total=False):
5449
Note that we do not guarantee that the system will follow these instructions
5550
exactly.
5651
"""
57-
58-
59-
class AgentConfigsFilterAndRerankConfig(TypedDict, total=False):
60-
rerank_instructions: str
61-
"""Instructions that the reranker references when ranking retrievals.
62-
63-
Note that we do not guarantee that the reranker will follow these instructions
64-
exactly. Examples: "Prioritize internal sales documents over market analysis
65-
reports. More recent documents should be weighted higher. Enterprise portal
66-
content supersedes distributor communications." and "Emphasize forecasts from
67-
top-tier investment banks. Recent analysis should take precedence. Disregard
68-
aggregator sites and favor detailed research notes over news summaries."
69-
"""
70-
71-
reranker_score_filter_threshold: float
72-
"""
73-
If the reranker relevance score associated with a chunk is below this threshold,
74-
then the chunk will be filtered out and not used for generation. Scores are
75-
between 0 and 1, with scores closer to 1 being more relevant. Set the value to 0
76-
to disable the reranker score filtering.
77-
"""
78-
79-
top_k_reranked_chunks: int
80-
"""The number of highest ranked chunks after reranking to be used"""
81-
82-
83-
class AgentConfigsGenerateResponseConfig(TypedDict, total=False):
84-
avoid_commentary: bool
85-
"""
86-
Flag to indicate whether the model should avoid providing additional commentary
87-
in responses. Commentary is conversational in nature and does not contain
88-
verifiable claims; therefore, commentary is not strictly grounded in available
89-
context. However, commentary may provide useful context which improves the
90-
helpfulness of responses.
91-
"""
92-
93-
calculate_groundedness: bool
94-
"""This parameter controls generation of groundedness scores."""
95-
96-
frequency_penalty: float
97-
"""
98-
This parameter adjusts how the model treats repeated tokens during text
99-
generation.
100-
"""
101-
102-
max_new_tokens: int
103-
"""The maximum number of tokens the model can generate in a response."""
104-
105-
seed: int
106-
"""
107-
This parameter controls the randomness of how the model selects the next tokens
108-
during text generation.
109-
"""
110-
111-
temperature: float
112-
"""The sampling temperature, which affects the randomness in the response."""
113-
114-
top_p: float
115-
"""
116-
A parameter for nucleus sampling, an alternative to `temperature` which also
117-
affects the randomness of the response.
118-
"""
119-
120-
121-
class AgentConfigsGlobalConfig(TypedDict, total=False):
122-
enable_filter: bool
123-
"""Enables filtering of retrieved chunks with a separate LLM"""
124-
125-
enable_multi_turn: bool
126-
"""Enables multi-turn conversations.
127-
128-
This feature is currently experimental and will be improved.
129-
"""
130-
131-
enable_rerank: bool
132-
"""Enables reranking of retrieved chunks"""
133-
134-
should_check_retrieval_need: bool
135-
"""Enables checking if retrieval is needed for the query.
136-
137-
This feature is currently experimental and will be improved.
138-
"""
139-
140-
141-
class AgentConfigsRetrievalConfig(TypedDict, total=False):
142-
lexical_alpha: float
143-
"""The weight of lexical search during retrieval.
144-
145-
Must sum to 1 with semantic_alpha.
146-
"""
147-
148-
semantic_alpha: float
149-
"""The weight of semantic search during retrieval.
150-
151-
Must sum to 1 with lexical_alpha.
152-
"""
153-
154-
top_k_retrieved_chunks: int
155-
"""The maximum number of retrieved chunks from the datastore."""
156-
157-
158-
class AgentConfigs(TypedDict, total=False):
159-
filter_and_rerank_config: AgentConfigsFilterAndRerankConfig
160-
"""Parameters that affect filtering and reranking of retrieved knowledge"""
161-
162-
generate_response_config: AgentConfigsGenerateResponseConfig
163-
"""Parameters that affect response generation"""
164-
165-
global_config: AgentConfigsGlobalConfig
166-
"""Parameters that affect the agent's overall RAG workflow"""
167-
168-
retrieval_config: AgentConfigsRetrievalConfig
169-
"""Parameters that affect how the agent retrieves from datastore(s)"""

0 commit comments

Comments
 (0)