Created
July 11, 2025 04:56
-
-
Save maskaravivek/72e1674ea2afca1d6b98476ca8a37746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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