Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token '<', " #6

Open
KokinSok opened this issue Mar 31, 2024 · 2 comments
Open

SyntaxError: Unexpected token '<', " #6

KokinSok opened this issue Mar 31, 2024 · 2 comments

Comments

@KokinSok
Copy link

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!

@KokinSok
Copy link
Author

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.

@Jiffy-JM
Copy link
Member

Jiffy-JM commented Apr 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants