-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Milestone
Description
All variable defined in the function scope shall be translated in the LLM context.
functions defined in the hosta injected scope shall be usable as tools by the LLM.
Class other than 'function' are not converted as tool. Consequently 'self' is not converted when hosta injected is defined inside a class ember.
This is mainly to prevent from uncontrolled recursive calls by the LLM.
This is an example of the expected implementation for an agent:
class MyAgent:
def __init__(self):
self.object_states = {
"lights": "off",
"thermostat": "22C",
"security system": "armed"
}
def ProcessInput(self, query):
"""
This function processes the input query and determines if it's a question or a command.
"""
if self.isQuestion(query):
return self.answerQuestion(query)
elif self.isCommand(query):
return self.executeCommand(query)
else:
return "I'm sorry, I don't understand the request."
def isQuestion(self, query):
"""
This function checks if the input query is a question.
"""
object_states = self.object_states
return emulate()
def isCommand(self, query):
"""
This function checks if the input query is a command.
"""
available_objects = ["lights", "thermostat", "security system"]
command_keywords = ["run", "execute", "start", "stop", "launch"]
return emulate()
def answerQuestion(self, query):
return emulate()
def executeCommand(self, keyword):
"""
This function executes a command based on the keyword.
"""
# This is a tool that the LLM can call
tool1 = self.startTheLights
# This is a second tool that the LLM can call
def invert(command:str):
"""
This function inverts the command from "start" to "stop" and vice versa.
"""
if command == "start":
return "stop"
elif command == "stop":
return "start"
else:
return command
return emulate()
def startTheLights(self, keyword):
"""
This function starts the lights in the smart home system.
"""
response = requests.get("http://my-smart-home-api/start-lights")
if response.status_code == 200:
return "Lights started successfully."
else:
return "Failed to start the lights."Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels