Create an Instance with multiple Data Sources
This tutorial will guide you through creating an instance with multiple data sources
Working Code to create an instance with multiple data sources: https://replit.com/join/gslztdjgrq-ishaan-jaff
import requests
url = "https://api.berri.ai/create_app"
payload = {
'user_email':
'ishaan@berri.ai',
'data_source':
'["hello world", "https://stripe.com/docs/india-accept-international-payments#TransactionPurposeCode"]'
}
files = {
'file1': open('proj1.pdf', 'rb'),
'file2': open('proj2.pdf', 'rb'),
'file3': open('geo.docx', 'rb'),
'file4': open('supabase.html', 'rb'),
}
print("Sending berri a request")
response = requests.request("POST", url, data=payload, files=files)
print(response.text)
print("playground link:", response.json()['playground_endpoint'])
1. How to Add Multiple Files
Define a dictionary named files that contains the files you want to upload as part of the request. The dictionary has key-value pairs, each representing a file to be uploaded: NOTE: You can name your files whatever you’d like
'file1': The first file to be uploaded, which is a PDF file named 'proj1.pdf'.
'file2': The second file to be uploaded, which is a PDF file named 'proj2.pdf'.
'file3': The third file to be uploaded, which is a DOCX file named 'geo.docx'.
'file4': The fourth file to be uploaded, which is an HTML file named 'supabase.html'.
2. How to Add multiple urls and raw strings
Create a dictionary named payload that contains the data you want to send in the request body. The dictionary has two key-value pairs:
‘user_email’: The email address of the user ‘data_source’: A string representation of a list containing your URLs and Strings
Eg definition of data_source ‘data_source’:’[“hello world”, ”https://stripe.com/docs/india-accept-international-payments#TransactionPurposeCode”]’