Flowise
Flowise copied to clipboard
[API input configuration]
Describe the feature you'd like Consider updating the documentation for API input configuration using a context manager for input files to upload
Proposed code:
data = {
"chunkSize": 1000,
"chunkOverlap": 200,
"metadata": file_path,
"question": "what is Pierre mentioning about Paris"
}
def query(data):
# Use a context manager to handle the file
with open(file_path, 'rb') as f:
# use form data to upload files
form_data = {
"files": (file_name, f)
}
response = requests.post(API_URL, files=form_data, data=data)
return response.json()
output = query(data)
output
@HenryHengZJ what needs to be done here? I can do this if you give me some hints.