ollama-api
ollama-api copied to clipboard
SyntaxError: Unexpected token '<', "
Great product, I like it! Thank You!
I am getting:
SyntaxError: Unexpected token '<', "
Models loaded, and not getting any other errors. Any ideas? Thank You!
Found the problem, was my error:
def run_model_question(question, model):
# Define the curl command
curl_command = f"curl http://localhost:11434/api/generate -d \"{{\\\"model\\\":\\\"{model}\\\", \\\"prompt\\\":\\\"{question}\\\"}}\""
print("Command: " + curl_command)
# Run the command and capture the output
output = subprocess.check_output(curl_command, shell=True, encoding='utf-8')
# Process the output as JSON and extract "response" values
responses = [json.loads(response)["response"] for response in output.strip().split('\n')]
# Create a JSON containing only "response" values
response_json = {'responses': responses}
return response_json
I had to change the strings, running on windows. In changing them, I did not realise it would get so complicated.
Hi Kokin. We fixed this in a updated test version. Thank you for the feedback and will commit the new code once testing is completed.