ibm-watsonx-orchestrate 1.11.0b0__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/connections.py +5 -2
- 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/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/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 +2 -1
- ibm_watsonx_orchestrate/docker/default.env +10 -10
- ibm_watsonx_orchestrate/flow_builder/flows/flow.py +3 -1
- ibm_watsonx_orchestrate/flow_builder/types.py +252 -1
- {ibm_watsonx_orchestrate-1.11.0b0.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/METADATA +2 -2
- {ibm_watsonx_orchestrate-1.11.0b0.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/RECORD +23 -23
- {ibm_watsonx_orchestrate-1.11.0b0.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/WHEEL +0 -0
- {ibm_watsonx_orchestrate-1.11.0b0.dist-info → ibm_watsonx_orchestrate-1.11.0b1.dist-info}/entry_points.txt +0 -0
- {ibm_watsonx_orchestrate-1.11.0b0.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")
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import logging
|
3
|
+
from copy import deepcopy
|
3
4
|
from typing import List
|
4
5
|
from ibm_watsonx_orchestrate.agent_builder.connections.types import (
|
5
6
|
BasicAuthCredentials,
|
@@ -67,7 +68,8 @@ def _clean_env_vars(vars: dict[str:str], requirements: List[str], app_id: str) -
|
|
67
68
|
return required_env_vars
|
68
69
|
|
69
70
|
def _build_credentials_model(credentials_type: type[CREDENTIALS], vars: dict[str,str], base_prefix: str) -> type[CREDENTIALS]:
|
70
|
-
|
71
|
+
requirements_lut = deepcopy(connection_type_requirements_mapping)
|
72
|
+
requirements = requirements_lut[credentials_type]
|
71
73
|
|
72
74
|
if requirements:
|
73
75
|
requirements.append("url")
|
@@ -101,7 +103,8 @@ def _get_credentials_model(connection_type: ConnectionSecurityScheme, app_id: st
|
|
101
103
|
|
102
104
|
credentials_type = CONNECTION_TYPE_CREDENTIAL_MAPPING[connection_type]
|
103
105
|
|
104
|
-
|
106
|
+
requirements_lut = deepcopy(connection_type_requirements_mapping)
|
107
|
+
requirements = requirements_lut.get(credentials_type)
|
105
108
|
if requirements:
|
106
109
|
variables = _clean_env_vars(vars=variables, requirements=requirements, app_id=app_id)
|
107
110
|
|
@@ -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,
|