Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maskaravivek/72e1674ea2afca1d6b98476ca8a37746 to your computer and use it in GitHub Desktop.
Save maskaravivek/72e1674ea2afca1d6b98476ca8a37746 to your computer and use it in GitHub Desktop.
@app.route('/ingest', methods=['POST'])
def ingest():
files = request.files.getlist('file')
results = []
for f in files:
filename = f.filename
# Read the file content as bytes for Ragie
file_content = f.read()
response = ragie.documents.create(request={
"file": {
"file_name": filename,
"content": file_content # Use the bytes content directly
},
"metadata": {
"source": "call_center" # custom metadata, not a Ragie param but for our reference
},
"mode": {"audio": True} # Explicitly enable audio processing mode
})
results.append({"document_id": response.id, "status": response.status})
return jsonify(results), 202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment