glaip-sdk 0.7.19__py3-none-any.whl → 0.7.20__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.
- glaip_sdk/agents/component.py +31 -19
- {glaip_sdk-0.7.19.dist-info → glaip_sdk-0.7.20.dist-info}/METADATA +1 -1
- {glaip_sdk-0.7.19.dist-info → glaip_sdk-0.7.20.dist-info}/RECORD +6 -6
- {glaip_sdk-0.7.19.dist-info → glaip_sdk-0.7.20.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.7.19.dist-info → glaip_sdk-0.7.20.dist-info}/entry_points.txt +0 -0
- {glaip_sdk-0.7.19.dist-info → glaip_sdk-0.7.20.dist-info}/top_level.txt +0 -0
glaip_sdk/agents/component.py
CHANGED
|
@@ -49,7 +49,7 @@ class AgentComponent(Component):
|
|
|
49
49
|
Formatted context string.
|
|
50
50
|
"""
|
|
51
51
|
if not context:
|
|
52
|
-
return "
|
|
52
|
+
return ""
|
|
53
53
|
|
|
54
54
|
formatted_items = []
|
|
55
55
|
for item in context:
|
|
@@ -125,9 +125,9 @@ class AgentComponent(Component):
|
|
|
125
125
|
|
|
126
126
|
if context:
|
|
127
127
|
context_str = self._format_context(context)
|
|
128
|
-
parts.append(f"
|
|
128
|
+
parts.append(f"Context:\n{context_str}\n")
|
|
129
129
|
|
|
130
|
-
parts.append(f"
|
|
130
|
+
parts.append(f"{query}\n")
|
|
131
131
|
|
|
132
132
|
return "\n".join(parts)
|
|
133
133
|
|
|
@@ -137,6 +137,7 @@ class AgentComponent(Component):
|
|
|
137
137
|
context: list[Chunk | Any] | None = None,
|
|
138
138
|
chat_history: list[Any] | None = None,
|
|
139
139
|
runtime_config: dict[str, Any] | None = None,
|
|
140
|
+
run_kwargs: dict[str, Any] | None = None,
|
|
140
141
|
) -> dict[str, Any]:
|
|
141
142
|
"""Run the agent with the provided context and history.
|
|
142
143
|
|
|
@@ -147,6 +148,7 @@ class AgentComponent(Component):
|
|
|
147
148
|
context: List of retrieved documents/chunks or data.
|
|
148
149
|
chat_history: List of previous conversation turns.
|
|
149
150
|
runtime_config: Optional configuration.
|
|
151
|
+
run_kwargs: Optional payload for advanced agent execution parameters.
|
|
150
152
|
|
|
151
153
|
Returns:
|
|
152
154
|
The raw response dictionary from the agent.
|
|
@@ -154,7 +156,7 @@ class AgentComponent(Component):
|
|
|
154
156
|
if not query:
|
|
155
157
|
raise ValueError("Query is required")
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
logger.info("Compiling prompt for agent: %s", self.agent.name)
|
|
158
160
|
|
|
159
161
|
prompt = self._compile_prompt(
|
|
160
162
|
query=query,
|
|
@@ -162,15 +164,16 @@ class AgentComponent(Component):
|
|
|
162
164
|
chat_history=chat_history,
|
|
163
165
|
)
|
|
164
166
|
|
|
165
|
-
|
|
167
|
+
params = (run_kwargs or {}).copy()
|
|
168
|
+
if runtime_config:
|
|
169
|
+
params["runtime_config"] = runtime_config
|
|
170
|
+
|
|
166
171
|
last_chunk = {}
|
|
167
172
|
|
|
168
173
|
try:
|
|
169
|
-
async for chunk in self.agent.arun(message=prompt,
|
|
174
|
+
async for chunk in self.agent.arun(message=prompt, **params):
|
|
170
175
|
if isinstance(chunk, dict):
|
|
171
176
|
last_chunk = chunk
|
|
172
|
-
# For non-streaming (or final output), we often get 'final_response' event
|
|
173
|
-
# but local runner might yield other events first.
|
|
174
177
|
if chunk.get("event_type") == "final_response":
|
|
175
178
|
return chunk
|
|
176
179
|
except Exception as e:
|
|
@@ -193,29 +196,38 @@ class AgentComponent(Component):
|
|
|
193
196
|
content = result.get("content")
|
|
194
197
|
if content is not None:
|
|
195
198
|
return str(content)
|
|
196
|
-
# Fallback: if no content field, return string representation
|
|
197
199
|
return str(result)
|
|
198
200
|
|
|
199
|
-
# If result is already a string, return it as-is
|
|
200
201
|
return str(result) if result is not None else ""
|
|
201
202
|
|
|
202
203
|
async def _run(self, **kwargs: Any) -> str:
|
|
203
204
|
"""Execute the component logic.
|
|
204
205
|
|
|
205
|
-
This method is called by the Component.run() method (and by Pipeline steps).
|
|
206
|
-
It delegates to run_agent() and extracts the content string from the response.
|
|
207
|
-
|
|
208
206
|
Args:
|
|
209
|
-
**kwargs: Keyword arguments
|
|
207
|
+
**kwargs: Keyword arguments including query, context, chat_history,
|
|
208
|
+
runtime_config, and run_kwargs. All execution control parameters
|
|
209
|
+
(e.g., local, verbose, temperature, etc.) must be provided via
|
|
210
|
+
run_kwargs dict.
|
|
210
211
|
|
|
211
212
|
Returns:
|
|
212
|
-
|
|
213
|
+
The content string extracted from the response.
|
|
213
214
|
"""
|
|
215
|
+
# Extract standard component inputs
|
|
216
|
+
query = kwargs.pop("query", None)
|
|
217
|
+
context = kwargs.pop("context", None)
|
|
218
|
+
chat_history = kwargs.pop("chat_history", None)
|
|
219
|
+
runtime_config = kwargs.pop("runtime_config", None)
|
|
220
|
+
run_kwargs = kwargs.pop("run_kwargs", None)
|
|
221
|
+
|
|
222
|
+
# Ignore any remaining unrecognized kwargs for API consistency
|
|
223
|
+
# All execution parameters must be provided via run_kwargs
|
|
224
|
+
|
|
214
225
|
result = await self.run_agent(
|
|
215
|
-
query=
|
|
216
|
-
context=
|
|
217
|
-
chat_history=
|
|
218
|
-
runtime_config=
|
|
226
|
+
query=query, # type: ignore[arg-type]
|
|
227
|
+
context=context,
|
|
228
|
+
chat_history=chat_history,
|
|
229
|
+
runtime_config=runtime_config,
|
|
230
|
+
run_kwargs=run_kwargs,
|
|
219
231
|
)
|
|
220
232
|
|
|
221
233
|
return self._extract_content_string(result)
|
|
@@ -6,7 +6,7 @@ glaip_sdk/icons.py,sha256=J5THz0ReAmDwIiIooh1_G3Le-mwTJyEjhJDdJ13KRxM,524
|
|
|
6
6
|
glaip_sdk/rich_components.py,sha256=44Z0V1ZQleVh9gUDGwRR5mriiYFnVGOhm7fFxZYbP8c,4052
|
|
7
7
|
glaip_sdk/agents/__init__.py,sha256=VfYov56edbWuySXFEbWJ_jLXgwnFzPk1KB-9-mfsUCc,776
|
|
8
8
|
glaip_sdk/agents/base.py,sha256=67rm67YWqwYjPcKD2-0Qc9Il7O6-8eRtd7lla_ZvALY,51259
|
|
9
|
-
glaip_sdk/agents/component.py,sha256=
|
|
9
|
+
glaip_sdk/agents/component.py,sha256=3cLLCL_x5OTwcEJx0zdst6RTEXOoAS3cTMkYtAOQb6I,7636
|
|
10
10
|
glaip_sdk/cli/__init__.py,sha256=xCCfuF1Yc7mpCDcfhHZTX0vizvtrDSLeT8MJ3V7m5A0,156
|
|
11
11
|
glaip_sdk/cli/account_store.py,sha256=u_memecwEQssustZs2wYBrHbEmKUlDfmmL-zO1F3n3A,19034
|
|
12
12
|
glaip_sdk/cli/agent_config.py,sha256=YAbFKrTNTRqNA6b0i0Q3pH-01rhHDRi5v8dxSFwGSwM,2401
|
|
@@ -218,8 +218,8 @@ glaip_sdk/utils/rendering/steps/format.py,sha256=Chnq7OBaj8XMeBntSBxrX5zSmrYeGcO
|
|
|
218
218
|
glaip_sdk/utils/rendering/steps/manager.py,sha256=BiBmTeQMQhjRMykgICXsXNYh1hGsss-fH9BIGVMWFi0,13194
|
|
219
219
|
glaip_sdk/utils/rendering/viewer/__init__.py,sha256=XrxmE2cMAozqrzo1jtDFm8HqNtvDcYi2mAhXLXn5CjI,457
|
|
220
220
|
glaip_sdk/utils/rendering/viewer/presenter.py,sha256=mlLMTjnyeyPVtsyrAbz1BJu9lFGQSlS-voZ-_Cuugv0,5725
|
|
221
|
-
glaip_sdk-0.7.
|
|
222
|
-
glaip_sdk-0.7.
|
|
223
|
-
glaip_sdk-0.7.
|
|
224
|
-
glaip_sdk-0.7.
|
|
225
|
-
glaip_sdk-0.7.
|
|
221
|
+
glaip_sdk-0.7.20.dist-info/METADATA,sha256=i7wKZIJif6O4DkrU_ePTba8k57FjCJqMwVKR5rHvmY8,8690
|
|
222
|
+
glaip_sdk-0.7.20.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
223
|
+
glaip_sdk-0.7.20.dist-info/entry_points.txt,sha256=NkhO6FfgX9Zrjn63GuKphf-dLw7KNJvucAcXc7P3aMk,54
|
|
224
|
+
glaip_sdk-0.7.20.dist-info/top_level.txt,sha256=td7yXttiYX2s94-4wFhv-5KdT0rSZ-pnJRSire341hw,10
|
|
225
|
+
glaip_sdk-0.7.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|