Scripted Agent WIP, only definitions
This commit is contained in:
1 parent
13e7c12e75
commit
5efe4f3325
4 files changed
+122
-1
No files matched your search
@@ -1,2 +1,3 @@
|
||||
from .character import CharacterAgent
|
||||
from .expert import ExpertAgent
|
||||
from .expert import ExpertAgent
|
||||
from .scripted import ScriptedAgent
|
||||
@@ -0,0 +1,31 @@
|
||||
import re
|
||||
import json
|
||||
import inspect
|
||||
from string import Template
|
||||
|
||||
from inference import LlamaMessage, replicate_llama_completion, Models
|
||||
from agent import Agent, AgentField
|
||||
|
||||
CLASS_DESCRIPTION = """
|
||||
Scripted agents can be configured with custom Python actions.
|
||||
The 'actions' config field has a list of action names. Each action is configured in a corresponding "action_name" with the name of the action, and contains: argument (object schema object), and body (python string source).
|
||||
""".strip()
|
||||
|
||||
class ScriptedAgent(Agent):
|
||||
identifier = "scripted"
|
||||
description = CLASS_DESCRIPTION
|
||||
schema_fields = [
|
||||
AgentField('actions', 'array', default=[]),
|
||||
]
|
||||
|
||||
def __init__(self, app, data):
|
||||
Agent.__init__(self, app, data)
|
||||
|
||||
async def prompt(self, instruction, input=None, **kwargs):
|
||||
raise Exception("Scripted agent cannot use prompts (Unimplemented)")
|
||||
|
||||
async def received_message(self, message):
|
||||
raise Exception("Scripted agent cannot use chat (Unimplemented)")
|
||||
|
||||
async def execute_action(self, name: str, argument: dict):
|
||||
raise Exception("No actions for this agent")
|
||||
@@ -39,6 +39,7 @@ class App(ChatMixin):
|
||||
agent_mod.BasicAgent,
|
||||
agents_mod.CharacterAgent,
|
||||
agents_mod.ExpertAgent,
|
||||
agents_mod.ScriptedAgent,
|
||||
|
||||
#agent_mod.LlamaAgent,
|
||||
#agent_mod.CoderV1Agent,
|
||||
|
||||
Reference in new issue
Block a user