Methods
__init__(template=None, memory=None, **kwargs)
Creates a new Agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
optional prompt jinja template, must include {{ text }} and {{ memory }} placeholders |
None
|
|
memory
|
number of prior outputs to keep as "memory", defaults to None for no memory |
None
|
|
kwargs
|
arguments to pass to the underlying Agent backend and LLM pipeline instance |
{}
|
Source code in txtai/agent/base.py
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 | |
__call__(text, maxlength=8192, stream=False, reset=False, **kwargs)
Runs an agent loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
instructions to run |
required | |
maxlength
|
maximum sequence length |
8192
|
|
stream
|
stream response if True, defaults to False |
False
|
|
reset
|
clears previously stored memory if True, defaults to False |
False
|
|
kwargs
|
additional keyword arguments |
{}
|
Returns:
| Type | Description |
|---|---|
|
result |
Source code in txtai/agent/base.py
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 | |