ibm-watsonx-orchestrate 1.10.2__py3-none-any.whl → 1.11.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ibm_watsonx_orchestrate/__init__.py +2 -1
- ibm_watsonx_orchestrate/agent_builder/agents/types.py +13 -0
- ibm_watsonx_orchestrate/agent_builder/connections/types.py +53 -6
- ibm_watsonx_orchestrate/agent_builder/knowledge_bases/types.py +24 -9
- ibm_watsonx_orchestrate/cli/commands/agents/agents_command.py +10 -2
- ibm_watsonx_orchestrate/cli/commands/agents/agents_controller.py +404 -173
- ibm_watsonx_orchestrate/cli/commands/connections/connections_command.py +33 -4
- ibm_watsonx_orchestrate/cli/commands/connections/connections_controller.py +62 -6
- ibm_watsonx_orchestrate/cli/commands/copilot/copilot_controller.py +6 -2
- ibm_watsonx_orchestrate/cli/commands/environment/environment_command.py +1 -1
- ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_command.py +174 -2
- ibm_watsonx_orchestrate/cli/commands/evaluations/evaluations_controller.py +93 -9
- ibm_watsonx_orchestrate/cli/commands/server/server_command.py +0 -3
- ibm_watsonx_orchestrate/cli/commands/server/types.py +14 -6
- ibm_watsonx_orchestrate/client/base_api_client.py +31 -10
- ibm_watsonx_orchestrate/client/connections/connections_client.py +14 -0
- ibm_watsonx_orchestrate/client/service_instance.py +19 -34
- ibm_watsonx_orchestrate/client/utils.py +3 -1
- ibm_watsonx_orchestrate/docker/compose-lite.yml +6 -1
- ibm_watsonx_orchestrate/docker/default.env +13 -11
- ibm_watsonx_orchestrate/flow_builder/data_map.py +4 -1
- ibm_watsonx_orchestrate/flow_builder/flows/flow.py +117 -7
- ibm_watsonx_orchestrate/flow_builder/node.py +76 -5
- ibm_watsonx_orchestrate/flow_builder/types.py +344 -10
- {ibm_watsonx_orchestrate-1.10.2.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/METADATA +2 -2
- {ibm_watsonx_orchestrate-1.10.2.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/RECORD +29 -29
- {ibm_watsonx_orchestrate-1.10.2.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/WHEEL +0 -0
- {ibm_watsonx_orchestrate-1.10.2.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/entry_points.txt +0 -0
- {ibm_watsonx_orchestrate-1.10.2.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/licenses/LICENSE +0 -0
@@ -223,6 +223,11 @@ class ExternalAgentSpec(BaseAgentSpec):
|
|
223
223
|
|
224
224
|
@model_validator(mode="before")
|
225
225
|
def validate_fields_for_external(cls, values):
|
226
|
+
# The get api responds with a flat object with no config
|
227
|
+
if values.get("config") is None:
|
228
|
+
values["config"] = {}
|
229
|
+
values["config"]["enable_cot"] = values.get("enable_cot", None)
|
230
|
+
values["config"]["hidden"] = values.get("hidden", None)
|
226
231
|
return validate_external_agent_fields(values)
|
227
232
|
|
228
233
|
@model_validator(mode="after")
|
@@ -276,6 +281,14 @@ class AssistantAgentSpec(BaseAgentSpec):
|
|
276
281
|
|
277
282
|
@model_validator(mode="before")
|
278
283
|
def validate_fields_for_external(cls, values):
|
284
|
+
if values.get("config") is None:
|
285
|
+
values["config"] = {}
|
286
|
+
values["config"]["api_version"] = values.get("api_version", None)
|
287
|
+
values["config"]["assistant_id"] = values.get("assistant_id", None)
|
288
|
+
values["config"]["crn"] = values.get("crn", None)
|
289
|
+
values["config"]["service_instance_url"] = values.get("service_instance_url", None)
|
290
|
+
values["config"]["environment_id"] = values.get("environment_id", None)
|
291
|
+
values["config"]["authorization_url"] = values.get("authorization_url", None)
|
279
292
|
return validate_assistant_agent_fields(values)
|
280
293
|
|
281
294
|
@model_validator(mode="after")
|
@@ -165,6 +165,53 @@ class ConnectionConfiguration(BaseModel):
|
|
165
165
|
raise ValueError("Connection of type 'key_value' cannot be configured at the 'member' level. Key value connections must be of type 'team'")
|
166
166
|
return self
|
167
167
|
|
168
|
+
class ConnectionCredentialsEntryLocation(str, Enum):
|
169
|
+
BODY = 'body'
|
170
|
+
HEADER = 'header',
|
171
|
+
QUERY = 'query'
|
172
|
+
|
173
|
+
def __str__(self):
|
174
|
+
return self.value
|
175
|
+
|
176
|
+
class ConnectionCredentialsEntry(BaseModel):
|
177
|
+
key: str
|
178
|
+
value: str
|
179
|
+
location: ConnectionCredentialsEntryLocation
|
180
|
+
|
181
|
+
def __str__(self):
|
182
|
+
return f"<ConnectionCredentialsEntry: {self.location}:{self.key}={self.value}>"
|
183
|
+
|
184
|
+
class BaseOAuthCredentials(BaseModel):
|
185
|
+
custom_token_query: Optional[dict] = None
|
186
|
+
custom_token_header: Optional[dict] = None
|
187
|
+
custom_token_body: Optional[dict] = None
|
188
|
+
custom_auth_query: Optional[dict] = None
|
189
|
+
|
190
|
+
class ConnectionCredentialsCustomFields(BaseOAuthCredentials):
|
191
|
+
def add_field(self, entry: ConnectionCredentialsEntry, is_token:bool=True) -> None:
|
192
|
+
match entry.location:
|
193
|
+
case ConnectionCredentialsEntryLocation.HEADER:
|
194
|
+
if not is_token:
|
195
|
+
return
|
196
|
+
attribute = "custom_token_header"
|
197
|
+
case ConnectionCredentialsEntryLocation.BODY:
|
198
|
+
if not is_token:
|
199
|
+
return
|
200
|
+
attribute = "custom_token_body"
|
201
|
+
case ConnectionCredentialsEntryLocation.QUERY:
|
202
|
+
if is_token:
|
203
|
+
attribute = "custom_token_query"
|
204
|
+
else:
|
205
|
+
attribute = "custom_auth_query"
|
206
|
+
case _:
|
207
|
+
return
|
208
|
+
|
209
|
+
fields = getattr(self, attribute)
|
210
|
+
if not fields:
|
211
|
+
setattr(self, attribute, {})
|
212
|
+
fields = getattr(self, attribute)
|
213
|
+
fields[entry.key] = entry.value
|
214
|
+
|
168
215
|
class BasicAuthCredentials(BaseModel):
|
169
216
|
username: str
|
170
217
|
password: str
|
@@ -182,7 +229,7 @@ class OAuth2TokenCredentials(BaseModel):
|
|
182
229
|
access_token: str
|
183
230
|
url: Optional[str] = None
|
184
231
|
|
185
|
-
class OAuth2AuthCodeCredentials(
|
232
|
+
class OAuth2AuthCodeCredentials(BaseOAuthCredentials):
|
186
233
|
client_id: str
|
187
234
|
client_secret: str
|
188
235
|
token_url: str
|
@@ -193,7 +240,7 @@ class OAuth2AuthCodeCredentials(BaseModel):
|
|
193
240
|
# client_id: str
|
194
241
|
# authorization_url: str
|
195
242
|
|
196
|
-
class OAuth2PasswordCredentials(
|
243
|
+
class OAuth2PasswordCredentials(BaseOAuthCredentials):
|
197
244
|
username: str
|
198
245
|
password: str
|
199
246
|
client_id: str
|
@@ -203,7 +250,7 @@ class OAuth2PasswordCredentials(BaseModel):
|
|
203
250
|
grant_type: str = "password"
|
204
251
|
|
205
252
|
|
206
|
-
class OAuth2ClientCredentials(
|
253
|
+
class OAuth2ClientCredentials(BaseOAuthCredentials):
|
207
254
|
client_id: str
|
208
255
|
client_secret: str
|
209
256
|
token_url: str
|
@@ -211,7 +258,7 @@ class OAuth2ClientCredentials(BaseModel):
|
|
211
258
|
send_via: ConnectionSendVia = ConnectionSendVia.HEADER
|
212
259
|
grant_type: str = "client_credentials"
|
213
260
|
|
214
|
-
class OAuthOnBehalfOfCredentials(
|
261
|
+
class OAuthOnBehalfOfCredentials(BaseOAuthCredentials):
|
215
262
|
client_id: str
|
216
263
|
access_token_url: str
|
217
264
|
grant_type: str
|
@@ -267,7 +314,7 @@ CONNECTION_TYPE_CREDENTIAL_MAPPING = {
|
|
267
314
|
ConnectionSecurityScheme.KEY_VALUE: KeyValueConnectionCredentials,
|
268
315
|
}
|
269
316
|
|
270
|
-
class IdentityProviderCredentials(
|
317
|
+
class IdentityProviderCredentials(BaseOAuthCredentials):
|
271
318
|
idp_url: str = Field(validation_alias=AliasChoices('idp_url', 'url'), serialization_alias='idp_url')
|
272
319
|
client_id: str
|
273
320
|
client_secret: str
|
@@ -276,4 +323,4 @@ class IdentityProviderCredentials(BaseModel):
|
|
276
323
|
|
277
324
|
class ExpectedCredentials(BaseModel):
|
278
325
|
app_id: str
|
279
|
-
type: ConnectionType | List[ConnectionType]
|
326
|
+
type: ConnectionType | List[ConnectionType]
|
@@ -3,7 +3,8 @@ from datetime import datetime
|
|
3
3
|
from uuid import UUID
|
4
4
|
from enum import Enum
|
5
5
|
|
6
|
-
from pydantic import BaseModel
|
6
|
+
from pydantic import BaseModel, model_validator
|
7
|
+
|
7
8
|
|
8
9
|
class SpecVersion(str, Enum):
|
9
10
|
V1 = "v1"
|
@@ -104,6 +105,7 @@ class GenerationConfiguration(BaseModel):
|
|
104
105
|
display_text_no_results_found: Optional[str] = None
|
105
106
|
display_text_connectivity_issue: Optional[str] = None
|
106
107
|
idk_message: Optional[str] = None
|
108
|
+
enabled: bool = True
|
107
109
|
|
108
110
|
class FieldMapping(BaseModel):
|
109
111
|
"""
|
@@ -224,15 +226,14 @@ class AstraDBConnection(BaseModel):
|
|
224
226
|
api_endpoint: str
|
225
227
|
port: Optional[str] = None
|
226
228
|
server_cert: Optional[str] = None
|
227
|
-
keyspace: Optional[str]
|
229
|
+
keyspace: Optional[str] = None
|
228
230
|
data_type: str
|
229
|
-
collection: Optional[str]
|
230
|
-
table: Optional[str]
|
231
|
-
index_column: Optional[str]
|
231
|
+
collection: Optional[str] = None
|
232
|
+
table: Optional[str] = None
|
233
|
+
index_column: Optional[str] = None
|
232
234
|
embedding_mode: str
|
233
|
-
embedding_model_id: Optional[str]
|
234
|
-
|
235
|
-
search_mode: str
|
235
|
+
embedding_model_id: Optional[str] = None
|
236
|
+
search_mode: Optional[str] = None
|
236
237
|
limit: Optional[int] = 5
|
237
238
|
filter: Optional[str] = None
|
238
239
|
field_mapping: Optional[FieldMapping] = None
|
@@ -243,7 +244,13 @@ class IndexConnection(BaseModel):
|
|
243
244
|
elastic_search: Optional[ElasticSearchConnection] = None
|
244
245
|
custom_search: Optional[CustomSearchConnection] = None
|
245
246
|
astradb: Optional[AstraDBConnection] = None
|
246
|
-
|
247
|
+
|
248
|
+
|
249
|
+
class QuerySource(str, Enum):
|
250
|
+
SessionHistory = "SessionHistory"
|
251
|
+
Agent = "Agent"
|
252
|
+
|
253
|
+
|
247
254
|
class ConversationalSearchConfig(BaseModel):
|
248
255
|
language: Optional[str] = None
|
249
256
|
index_config: list[IndexConnection] = None
|
@@ -252,6 +259,14 @@ class ConversationalSearchConfig(BaseModel):
|
|
252
259
|
citations: Optional[CitationsConfig] = None
|
253
260
|
hap_filtering: Optional[HAPFiltering] = None
|
254
261
|
confidence_thresholds: Optional[ConfidenceThresholds] = None
|
262
|
+
query_source: QuerySource = QuerySource.SessionHistory
|
263
|
+
agent_query_description: str = "The query to search for in the knowledge base"
|
264
|
+
|
265
|
+
@model_validator(mode="after")
|
266
|
+
def validate_agent_query_description(self) -> 'ConversationalSearchConfig':
|
267
|
+
if self.query_source == QuerySource.Agent and len(self.agent_query_description) == 0:
|
268
|
+
raise ValueError("Provide a non-empty agent_query_description when query source is `Agent`")
|
269
|
+
return self
|
255
270
|
|
256
271
|
class KnowledgeBaseBuiltInVectorIndexConfig(BaseModel):
|
257
272
|
embeddings_model_name: Optional[str] = None
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import typer
|
2
|
-
from typing_extensions import Annotated, List
|
2
|
+
from typing_extensions import Annotated, List, Optional
|
3
3
|
from ibm_watsonx_orchestrate.cli.commands.agents.agents_controller import AgentsController
|
4
4
|
from ibm_watsonx_orchestrate.agent_builder.agents.types import DEFAULT_LLM, AgentKind, AgentStyle, ExternalAgentAuthScheme, AgentProvider
|
5
5
|
import json
|
@@ -14,7 +14,7 @@ def agent_import(
|
|
14
14
|
typer.Option("--file", "-f", help="YAML file with agent definition"),
|
15
15
|
],
|
16
16
|
app_id: Annotated[
|
17
|
-
str, typer.Option(
|
17
|
+
Optional[str], typer.Option(
|
18
18
|
'--app-id', '-a',
|
19
19
|
help='The app id of the connection to associate with this external agent. An application connection represents the server authentication credentials needed to connection to this agent (for example Api Keys, Basic, Bearer or OAuth credentials).'
|
20
20
|
)
|
@@ -46,6 +46,13 @@ def agent_create(
|
|
46
46
|
AgentKind,
|
47
47
|
typer.Option("--kind", "-k", help="The kind of agent you wish to create"),
|
48
48
|
] = AgentKind.NATIVE,
|
49
|
+
instructions: Annotated[
|
50
|
+
str,
|
51
|
+
typer.Option(
|
52
|
+
"--instructions",
|
53
|
+
help="A set of instructions for how the agent should preform actions.",
|
54
|
+
),
|
55
|
+
] = None,
|
49
56
|
api_url: Annotated[
|
50
57
|
str,
|
51
58
|
typer.Option("--api", "-a", help="External Api url your Agent will use"),
|
@@ -175,6 +182,7 @@ def agent_create(
|
|
175
182
|
kind=kind,
|
176
183
|
description=description,
|
177
184
|
title=title,
|
185
|
+
instructions=instructions,
|
178
186
|
api_url=api_url,
|
179
187
|
auth_scheme=auth_scheme,
|
180
188
|
auth_config=auth_config_dict,
|