Core Agent Classes#
Base Types#
Base agent type.
BaseAgent #
Bases: BaseChatEngine
, BaseQueryEngine
Base Agent.
Source code in llama-index-core/llama_index/core/agent/types.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
BaseAgentWorker #
Bases: PromptMixin
Base agent worker.
Source code in llama-index-core/llama_index/core/agent/types.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
initialize_step
abstractmethod
#
Initialize step from task.
Source code in llama-index-core/llama_index/core/agent/types.py
205 206 207 |
|
run_step
abstractmethod
#
run_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/types.py
209 210 211 |
|
arun_step
abstractmethod
async
#
arun_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/types.py
213 214 215 216 217 218 |
|
stream_step
abstractmethod
#
stream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/types.py
220 221 222 223 224 |
|
astream_step
abstractmethod
async
#
astream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/types.py
226 227 228 229 230 231 |
|
finalize_task
abstractmethod
#
finalize_task(task: Task, **kwargs: Any) -> None
Finalize task, after all the steps are completed.
Source code in llama-index-core/llama_index/core/agent/types.py
233 234 235 |
|
set_callback_manager #
set_callback_manager(callback_manager: CallbackManager) -> None
Set callback manager.
Source code in llama-index-core/llama_index/core/agent/types.py
237 238 |
|
Task #
Bases: BaseModel
Agent Task.
Represents a "run" of an agent given a user input.
Source code in llama-index-core/llama_index/core/agent/types.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
TaskStep #
Bases: BaseModel
Agent task step.
Represents a single input step within the execution run ("Task") of an agent given a user input.
The output is returned as a TaskStepOutput
.
Source code in llama-index-core/llama_index/core/agent/types.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
get_next_step #
get_next_step(step_id: str, input: Optional[str] = None, step_state: Optional[Dict[str, Any]] = None) -> TaskStep
Convenience function to get next step.
Preserve task_id, memory, step_state.
Source code in llama-index-core/llama_index/core/agent/types.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
link_step #
link_step(next_step: TaskStep) -> None
Link to next step.
Add link from this step to next, and from next step to current.
Source code in llama-index-core/llama_index/core/agent/types.py
121 122 123 124 125 126 127 128 129 130 131 |
|
TaskStepOutput #
Bases: BaseModel
Agent task step output.
Source code in llama-index-core/llama_index/core/agent/types.py
134 135 136 137 138 139 140 141 142 143 144 |
|
Runners#
AgentRunner #
Bases: BaseAgentRunner
Agent runner.
Top-level agent orchestrator that can create tasks, run each step in a task, or run a task e2e. Stores state and keeps track of tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_worker |
BaseAgentWorker
|
step executor |
required |
chat_history |
Optional[List[ChatMessage]]
|
chat history. Defaults to None. |
None
|
state |
Optional[AgentState]
|
agent state. Defaults to None. |
None
|
memory |
Optional[BaseMemory]
|
memory. Defaults to None. |
None
|
llm |
Optional[LLM]
|
LLM. Defaults to None. |
None
|
callback_manager |
Optional[CallbackManager]
|
callback manager. Defaults to None. |
None
|
init_task_state_kwargs |
Optional[dict]
|
init task state kwargs. Defaults to None. |
None
|
Source code in llama-index-core/llama_index/core/agent/runner/base.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
|
create_task #
create_task(input: str, **kwargs: Any) -> Task
Create task.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
delete_task #
delete_task(task_id: str) -> None
Delete task.
NOTE: this will not delete any previous executions from memory.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
331 332 333 334 335 336 337 338 339 340 |
|
list_tasks #
list_tasks(**kwargs: Any) -> List[Task]
List tasks.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
342 343 344 |
|
get_task #
get_task(task_id: str, **kwargs: Any) -> Task
Get task.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
346 347 348 |
|
get_upcoming_steps #
get_upcoming_steps(task_id: str, **kwargs: Any) -> List[TaskStep]
Get upcoming steps.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
350 351 352 |
|
get_completed_steps #
get_completed_steps(task_id: str, **kwargs: Any) -> List[TaskStepOutput]
Get completed steps.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
354 355 356 |
|
run_step #
run_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
434 435 436 437 438 439 440 441 442 443 444 445 |
|
arun_step
async
#
arun_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/runner/base.py
447 448 449 450 451 452 453 454 455 456 457 458 |
|
stream_step #
stream_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/runner/base.py
460 461 462 463 464 465 466 467 468 469 470 471 |
|
astream_step
async
#
astream_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/runner/base.py
473 474 475 476 477 478 479 480 481 482 483 484 |
|
finalize_response #
finalize_response(task_id: str, step_output: Optional[TaskStepOutput] = None) -> AGENT_CHAT_RESPONSE_TYPE
Finalize response.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
undo_step #
undo_step(task_id: str) -> None
Undo previous step.
Source code in llama-index-core/llama_index/core/agent/runner/base.py
673 674 675 |
|
ParallelAgentRunner #
Bases: BaseAgentRunner
Parallel agent runner.
Executes steps in queue in parallel. Requires async support.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
create_task #
create_task(input: str, **kwargs: Any) -> Task
Create task.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
delete_task #
delete_task(task_id: str) -> None
Delete task.
NOTE: this will not delete any previous executions from memory.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
128 129 130 131 132 133 134 135 136 137 |
|
list_tasks #
list_tasks(**kwargs: Any) -> List[Task]
List tasks.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
139 140 141 142 |
|
get_task #
get_task(task_id: str, **kwargs: Any) -> Task
Get task.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
144 145 146 |
|
get_upcoming_steps #
get_upcoming_steps(task_id: str, **kwargs: Any) -> List[TaskStep]
Get upcoming steps.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
148 149 150 |
|
get_completed_steps #
get_completed_steps(task_id: str, **kwargs: Any) -> List[TaskStepOutput]
Get completed steps.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
152 153 154 |
|
run_steps_in_queue #
run_steps_in_queue(task_id: str, mode: ChatResponseMode = ChatResponseMode.WAIT, **kwargs: Any) -> List[TaskStepOutput]
Execute steps in queue.
Run all steps in queue, clearing it out.
Assume that all steps can be run in parallel.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
arun_steps_in_queue
async
#
arun_steps_in_queue(task_id: str, mode: ChatResponseMode = ChatResponseMode.WAIT, **kwargs: Any) -> List[TaskStepOutput]
Execute all steps in queue.
All steps in queue are assumed to be ready.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
run_step #
run_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
260 261 262 263 264 265 266 267 268 |
|
arun_step
async
#
arun_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
270 271 272 273 274 275 276 277 278 279 280 |
|
stream_step #
stream_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
282 283 284 285 286 287 288 289 290 |
|
astream_step
async
#
astream_step(task_id: str, input: Optional[str] = None, step: Optional[TaskStep] = None, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
292 293 294 295 296 297 298 299 300 301 302 |
|
finalize_response #
finalize_response(task_id: str, step_output: Optional[TaskStepOutput] = None) -> AGENT_CHAT_RESPONSE_TYPE
Finalize response.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
|
undo_step #
undo_step(task_id: str) -> None
Undo previous step.
Source code in llama-index-core/llama_index/core/agent/runner/parallel.py
476 477 478 |
|
Workers#
CustomSimpleAgentWorker #
Bases: BaseModel
, BaseAgentWorker
Custom simple agent worker.
This is "simple" in the sense that some of the scaffolding is setup already.
Assumptions:
- assumes that the agent has tools, llm, callback manager, and tool retriever
- has a from_tools
convenience function
- assumes that the agent is sequential, and doesn't take in any additional
intermediate inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tools |
Sequence[BaseTool]
|
Tools to use for reasoning |
required |
llm |
LLM
|
LLM to use |
required |
callback_manager |
CallbackManager
|
Callback manager |
None
|
tool_retriever |
Optional[ObjectRetriever[BaseTool]]
|
Tool retriever |
None
|
verbose |
bool
|
Whether to print out reasoning steps |
False
|
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
from_tools
classmethod
#
from_tools(tools: Optional[Sequence[BaseTool]] = None, tool_retriever: Optional[ObjectRetriever[BaseTool]] = None, llm: Optional[LLM] = None, callback_manager: Optional[CallbackManager] = None, verbose: bool = False, **kwargs: Any) -> CustomSimpleAgentWorker
Convenience constructor method from set of of BaseTools (Optional).
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
initialize_step #
Initialize step from task.
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
get_tools #
get_tools(input: str) -> List[AsyncBaseTool]
Get tools.
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
153 154 155 |
|
run_step #
run_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
205 206 207 208 209 210 211 212 213 214 |
|
arun_step
async
#
arun_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
216 217 218 219 220 221 222 223 224 225 226 |
|
stream_step #
stream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
228 229 230 231 |
|
astream_step
async
#
astream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
233 234 235 236 237 238 |
|
finalize_task #
finalize_task(task: Task, **kwargs: Any) -> None
Finalize task, after all the steps are completed.
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
248 249 250 251 252 253 254 |
|
set_callback_manager #
set_callback_manager(callback_manager: CallbackManager) -> None
Set callback manager.
Source code in llama-index-core/llama_index/core/agent/custom/simple.py
256 257 258 259 |
|
MultimodalReActAgentWorker #
Bases: BaseAgentWorker
Multimodal ReAct Agent worker.
NOTE: This is a BETA feature.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
|
from_tools
classmethod
#
from_tools(tools: Optional[Sequence[BaseTool]] = None, tool_retriever: Optional[ObjectRetriever[BaseTool]] = None, multi_modal_llm: Optional[MultiModalLLM] = None, max_iterations: int = 10, react_chat_formatter: Optional[ReActChatFormatter] = None, output_parser: Optional[ReActOutputParser] = None, callback_manager: Optional[CallbackManager] = None, verbose: bool = False, **kwargs: Any) -> MultimodalReActAgentWorker
Convenience constructor method from set of of BaseTools (Optional).
NOTE: kwargs should have been exhausted by this point. In other words the various upstream components such as BaseSynthesizer (response synthesizer) or BaseRetriever should have picked up off their respective kwargs in their constructions.
Returns:
Type | Description |
---|---|
MultimodalReActAgentWorker
|
ReActAgent |
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
initialize_step #
Initialize step from task.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
get_tools #
get_tools(input: str) -> List[AsyncBaseTool]
Get tools.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
229 230 231 |
|
run_step #
run_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
478 479 480 481 |
|
arun_step
async
#
arun_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
483 484 485 486 487 488 |
|
stream_step #
stream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
490 491 492 493 494 |
|
astream_step
async
#
astream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
496 497 498 499 500 501 |
|
finalize_task #
finalize_task(task: Task, **kwargs: Any) -> None
Finalize task, after all the steps are completed.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
503 504 505 506 507 508 509 510 |
|
set_callback_manager #
set_callback_manager(callback_manager: CallbackManager) -> None
Set callback manager.
Source code in llama-index-core/llama_index/core/agent/react_multimodal/step.py
512 513 514 515 |
|
QueryPipelineAgentWorker #
Bases: BaseModel
, BaseAgentWorker
Query Pipeline agent worker.
Barebones agent worker that takes in a query pipeline.
Assumes that the first component in the query pipeline is an
AgentInputComponent
and last is AgentFnComponent
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
QueryPipeline
|
Query pipeline |
required |
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
agent_input_component
property
#
agent_input_component: AgentInputComponent
Get agent input component.
initialize_step #
Initialize step from task.
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
run_step #
run_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step.
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
147 148 149 150 151 152 153 154 155 156 157 158 |
|
arun_step
async
#
arun_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async).
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
stream_step #
stream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (stream).
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
176 177 178 179 |
|
astream_step
async
#
astream_step(step: TaskStep, task: Task, **kwargs: Any) -> TaskStepOutput
Run step (async stream).
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
181 182 183 184 185 186 |
|
finalize_task #
finalize_task(task: Task, **kwargs: Any) -> None
Finalize task, after all the steps are completed.
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
188 189 190 191 192 193 |
|
set_callback_manager #
set_callback_manager(callback_manager: CallbackManager) -> None
Set callback manager.
Source code in llama-index-core/llama_index/core/agent/custom/pipeline_worker.py
195 196 197 198 199 |
|