Chris4K's picture
Create controller.py
6827c6b verified
raw
history blame
646 Bytes
from logger import log_response
from custom_agent import CustomHfAgent
def handle_submission(user_message, selected_tools, url_endpoint):
log_response("User input \n {}".format(user_message))
log_response("selected_tools \n {}".format(selected_tools))
log_response("url_endpoint \n {}".format(url_endpoint))
agent = CustomHfAgent(
url_endpoint=url_endpoint,
token=os.environ['HF_token'],
additional_tools=selected_tools,
input_params={"max_new_tokens": 192},
)
response = agent.run(user_message)
log_response("Agent Response\n {}".format(response))
return response