Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[API input configuration]

Open cnndabbler opened this issue 1 year ago • 1 comments

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

cnndabbler avatar Jun 05 '23 18:06 cnndabbler

@HenryHengZJ what needs to be done here? I can do this if you give me some hints.

govind-kumarr avatar Jun 09 '23 07:06 govind-kumarr