File size: 841 Bytes
c7e94cf
6827c6b
 
a0ffd43
0518eba
6827c6b
 
 
 
0518eba
 
b7bb43b
6827c6b
 
 
 
 
 
 
 
b7bb43b
6827c6b
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
from logger import log_response
from custom_agent import CustomHfAgent 
image = []
def handle_submission(user_message, selected_tools, url_endpoint, document, image):
    
    log_response("User input \n {}".format(user_message))
    log_response("selected_tools \n {}".format(selected_tools))
    log_response("url_endpoint \n {}".format(url_endpoint))
    log_response("url_endpoint \n {}".format(document))
    log_response("url_endpoint \n {}".format(image))
    image = image
    
    agent = CustomHfAgent(
        url_endpoint=url_endpoint,
        token=os.environ['HF_token'],
        additional_tools=selected_tools,
        input_params={"max_new_tokens": 192},
    )

    response = agent.chat(user_message,document=document,image=image)

    log_response("Agent Response\n {}".format(response))

    return response