|
5 | 5 | from typing import List |
6 | 6 | from typing_extensions import Required, TypedDict |
7 | 7 |
|
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"] |
16 | 11 |
|
17 | 12 |
|
18 | 13 | class AgentCreateParams(TypedDict, total=False): |
19 | 14 | name: Required[str] |
20 | 15 | """Name of the agent""" |
21 | 16 |
|
22 | | - agent_configs: AgentConfigs |
| 17 | + agent_configs: AgentConfigsParam |
23 | 18 | """The following advanced parameters are experimental and subject to change.""" |
24 | 19 |
|
25 | 20 | datastore_ids: List[str] |
@@ -54,116 +49,3 @@ class AgentCreateParams(TypedDict, total=False): |
54 | 49 | Note that we do not guarantee that the system will follow these instructions |
55 | 50 | exactly. |
56 | 51 | """ |
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