|
|
|
|
|
|
|
|
inputs.append(text) |
|
|
inputs.append(text) |
|
|
|
|
|
|
|
|
# Prepare the payload for the request |
|
|
# Prepare the payload for the request |
|
|
payload = { |
|
|
|
|
|
"input": inputs, |
|
|
|
|
|
"model": model, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
payload = {"input": inputs, "model": model, "options": {"use_mmap": "true"}} |
|
|
|
|
|
|
|
|
# Make the request to the OpenAI API |
|
|
|
|
|
response = requests.post( |
|
|
|
|
|
endpoint_url, headers=headers, data=json.dumps(payload), timeout=(10, 300), options={"use_mmap": "true"} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
# Make the request to the Ollama API |
|
|
|
|
|
response = requests.post(endpoint_url, headers=headers, data=json.dumps(payload), timeout=(10, 300)) |
|
|
|
|
|
|
|
|
response.raise_for_status() # Raise an exception for HTTP errors |
|
|
response.raise_for_status() # Raise an exception for HTTP errors |
|
|
response_data = response.json() |
|
|
response_data = response.json() |