Call endpoints
call_endpoint(api_route, parameters)
Makes a POST request to a specified API endpoint.
This function sends a POST request to the given RAG endpoint with the provided parameters and returns the JSON response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_route
|
str
|
The API route to which the POST request is sent. |
required |
parameters
|
dict
|
The parameters to be included in the POST request body. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The JSON response from the API. |
Raises:
Type | Description |
---|---|
RequestException
|
If an error occurs during the HTTP request, |
Source code in view/streamlit_app/call_endpoints.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
upload_endpoint(headers, files, params)
Makes a POST request to upload PDF files to a specified API endpoint.
This function sends a file upload request to the /upload
endpoint with the provided headers,
files, and parameters. It returns the JSON response from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
headers
|
dict
|
Headers to include in the POST request, such as authentication tokens. |
required |
files
|
dict
|
Files to upload, with keys representing the field names and values as file objects. |
required |
params
|
dict
|
Additional parameters to include in the request query string. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The JSON response from the API. |
Raises:
Type | Description |
---|---|
RequestException
|
If an error occurs during the HTTP request, |
Source code in view/streamlit_app/call_endpoints.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|