patrickloeber / ai-typing-assistant

AI powered local typing assistant built with Ollama
https://patloeber.com/typing-assistant-llm/
MIT License
291 stars 34 forks source link

400 error #4

Closed LockonHan closed 6 months ago

LockonHan commented 6 months ago

When I try to access the local Mistral model using your code, the model always returns a 400 bad request. I deployed the model through Ollama on Win11. What could be the reason for this?

LockonHan commented 6 months ago

It seems alright when I deal with powershell when the error 400 occur

(base) PS C:\Users\s***> (Invoke-WebRequest -method POST -Body '{"model":"mistral:7b-instruct-v0.2-q4_K_S", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json

model : mistral:7b-instruct-v0.2-q4_K_S created_at : 2024-03-12T09:02:43.3331445Z response : The sky appears to be blue due to a process called scattering. When the sun's light enters Earth's atmosphere, it collides with molecules and tiny particl es in the air, causing the light to scatter in all directions. Blue light has shorter wavelengths and gets scattered more easily than other colors, making the sky appear blue during a clear day. However, at sunrise or sunset, the sky can take on hues of red, orange, and pink because those longer wavelengths a re not as easily scattered and get reflected and refracted by the atmosphere in a specific way. done : True context : {733, 16289, 28793, 28705...} total_duration : 3702267600 load_duration : 749500 prompt_eval_duration : 253710000 eval_count : 123 eval_duration : 3447167000