Reasoning
Reasoning Engine¶
director.core.reasoning.ReasoningEngine
¶
The Reasoning Engine is the core class that directly interfaces with the user. It interprets natural language input in any conversation and orchestrates agents to fulfill the user's requests. The primary functions of the Reasoning Engine are:
- Maintain Context of Conversational History: Manage memory, context limits, input, and output experiences to ensure coherent and context-aware interactions.
- Natural Language Understanding (NLU): Uses LLMs of your choice to have understanding of the task.
- Intelligent Reference Deduction: Intelligently deduce references to previous messages, outputs, files, agents, etc., to provide relevant and accurate responses.
- Agent Orchestration: Decide on agents and their workflows to fulfill requests. Multiple strategies can be employed to create agent workflows, such as step-by-step processes or chaining of agents provided by default.
- Final Control Over Conversation Flow: Maintain ultimate control over the flow of conversation with the user, ensuring coherence and goal alignment.
Initialize the ReasoningEngine with the input message and session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_message |
InputMessage
|
The input message to the reasoning engine. |
required |
session |
Session
|
The session instance. |
required |
Source code in backend/director/core/reasoning.py
register_agents
¶
Register an agents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agents |
List[BaseAgent]
|
The list of agents to register. |
required |
build_context
¶
Build the context for the reasoning engine it adds the information about the video or collection to the reasoning context.
Source code in backend/director/core/reasoning.py
run_agent
¶
Run an agent with the given name and arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_name |
str
|
The name of the agent to run |
required |
args |
The arguments to pass to the agent |
()
|
|
kwargs |
The keyword arguments to pass to the agent |
{}
|
Returns:
Type | Description |
---|---|
AgentResponse
|
The response from the agent |
Source code in backend/director/core/reasoning.py
stop
¶
step
¶
Run a single step of the reasoning engine.
Source code in backend/director/core/reasoning.py
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 |
|
run
¶
Run the reasoning engine.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_iterations |
int
|
The number of max_iterations to run the reasoning engine |
None
|