New web interface, move llm engine to separate process
This commit is contained in:
77
README.md
77
README.md
@@ -311,18 +311,51 @@ Or xml comments used for inline reasoning are not saved after parsing.
|
||||
|
||||
LLM engine subprocesses receive input as XML documents containing paths to required files and the context.
|
||||
|
||||
**Example input to LLM engine subprocess:**
|
||||
##### Example interaction with the LLM engine subprocess:
|
||||
|
||||
**Core -> LLM engine**
|
||||
|
||||
```xml
|
||||
<input>
|
||||
<system_prompt_path>/root/sia/system_prompt.md</system_prompt_path>
|
||||
<action_schema_path>/root/sia/action_schema.xsd</action_schema_path>
|
||||
<context>
|
||||
<context time="2024-10-18T12:00:00Z" memory_used="9556302234" memory_total="17179869184">
|
||||
<!-- Working memory entries -->
|
||||
</context>
|
||||
</context>
|
||||
<prefix><!-- Optional existing text to continue --></prefix>
|
||||
</input>
|
||||
<token_limit/>
|
||||
```
|
||||
|
||||
**LLM engine -> Core**
|
||||
|
||||
```
|
||||
1024\u0004
|
||||
```
|
||||
|
||||
**Core -> LLM engine**
|
||||
|
||||
```xml
|
||||
<token_count>
|
||||
<schema>/root/sia/action_schema.xsd</schema>
|
||||
<system><![CDATA[...]]></system>
|
||||
<context><![CDATA[...]]></context>
|
||||
</token_count>
|
||||
```
|
||||
|
||||
**LLM engine -> Core**
|
||||
|
||||
```
|
||||
405\u0004
|
||||
```
|
||||
|
||||
**Core -> LLM engine**
|
||||
|
||||
```xml
|
||||
<infer_xml>
|
||||
<schema>/root/sia/action_schema.xsd</schema>
|
||||
<system><![CDATA[...]]></system>
|
||||
<context><![CDATA[...]]></context>
|
||||
<prefix><![CDATA[...]]></prefix>
|
||||
</infer_xml>
|
||||
```
|
||||
|
||||
**LLM engine -> Core**
|
||||
|
||||
```xml
|
||||
<reasoning>...</reasoning>
|
||||
```
|
||||
|
||||
Though the LLM can output any text, the goal is to output valid xml.
|
||||
@@ -336,13 +369,6 @@ This character was chosen because:
|
||||
- It's a single byte, making it efficient to process
|
||||
- It's standard across all platforms
|
||||
|
||||
**Example output from LLM engine subprocess:**
|
||||
```
|
||||
<reasoning>
|
||||
I should check the current state of the system and see if there are any pending tasks.
|
||||
</reasoning>\u0004
|
||||
```
|
||||
|
||||
The communication protocol between the SIA agent and LLM engine subprocesses has been designed with simplicity as the primary goal.
|
||||
Opting for a minimal approach that:
|
||||
|
||||
@@ -453,16 +479,19 @@ classDiagram
|
||||
-monitor_loop() void
|
||||
}
|
||||
|
||||
class LLMEngine {
|
||||
+LLMEngine(executable_path str)
|
||||
+infer(system_prompt str, main_context str, prefix str) Iterator~str~
|
||||
class LlmEngine {
|
||||
+LlmEngine(executable_path str, action_schema_path str)
|
||||
+infer(system_prompt str, main_context ET, prefix str) Iterator~str~
|
||||
+token_count(system_prompt str, main_context ET, prefix str) int
|
||||
+token_limit() int
|
||||
+restart()
|
||||
}
|
||||
|
||||
class BaseAgent {
|
||||
<<abstract>>
|
||||
-working_memory: WorkingMemory
|
||||
-metrics: SystemMetrics
|
||||
-llm: LLMEngine
|
||||
-llm: LlmEngine
|
||||
-parser: ResponseParser
|
||||
-validator: XMLValidator
|
||||
-action_schema: str
|
||||
@@ -522,7 +551,7 @@ classDiagram
|
||||
}
|
||||
|
||||
SystemMetrics "1" --* "1" BaseAgent
|
||||
LLMEngine "1" --* "1" BaseAgent
|
||||
LlmEngine "1" --* "1" BaseAgent
|
||||
XMLValidator "1" --* "1" BaseAgent
|
||||
BaseAgent "1" *-- "1" IOBuffer
|
||||
BaseAgent "1" *-- "1" WorkingMemory
|
||||
@@ -560,7 +589,7 @@ classDiagram
|
||||
<<abstract>>
|
||||
-working_memory: WorkingMemory
|
||||
-metrics: SystemMetrics
|
||||
-llm: LLMEngine
|
||||
-llm: LlmEngine
|
||||
-parser: ResponseParser
|
||||
-validator: XMLValidator
|
||||
-action_schema: str
|
||||
|
||||
Reference in New Issue
Block a user