I want to pass params to a Tool's "func" in the code. But chat model has all the control of the "func" (as I know). So I want to give info to the func in Tool() directly. Is there a way to pass?
realistic_vision_tool = Tool(
name="realistic_vision_V1.4 image generating",
func=realistic_vision_v1_4, #would like to pass some params here
description="""Use when you want to generate an image of something with realistic_vision model. Input like "a dog standing on a rock" is decent for this tool so input not-so-detailed prompts to this tool. If an image is generated, tool will return "Successfully generated image.\". Say something like "Generated. Hope it helps.\" if you use this tool. Always input english prompts for the input, even if the user is not speaking english. Enter the inputs in english to this tool."""
)
I want to pass the params here. Heres the func()
:
def realistic_vision_v1_4(prompt, username, conversation_name):
API_URL = (
"https://api-inference.huggingface.co/models/SG161222/Realistic_Vision_V1.4"
)
headers = {"Authorization": "Bearer XXX"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
image_bytes = query(
{
"inputs": prompt
+ ", (high detailed skin:1.2), 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3",
}
)
database.upload_current_img(username, conversation_name, image_bytes) #it wants username and conversation name to store the img_bin
return "Successfully generated image."