[GH-ISSUE #3072] API not working on Windows #1891

Closed
opened 2026-04-12 11:59:13 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @WiseMarius on GitHub (Mar 12, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3072

Hi there,

I was just trying to run ollama on Windows but the API somehow does not work.
image
image

Originally created by @WiseMarius on GitHub (Mar 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3072 Hi there, I was just trying to run ollama on Windows but the API somehow does not work. ![image](https://github.com/ollama/ollama/assets/25198837/e752df03-3200-4023-a9b6-05e95d91c8be) ![image](https://github.com/ollama/ollama/assets/25198837/6e0f56d0-6e66-4292-ae5e-24253f14aafd)
Author
Owner

@jmorganca commented on GitHub (Mar 12, 2024):

Hi there, thanks for creating an issue. To call /api/generate or /api/chat, you need to provide the POST method. You can try this in two ways:

  1. ollama run codellama will do this for you interactively
  2. You can use powershell in the terminal:
(Invoke-WebRequest -method POST -Body '{"model":"codellama", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json

Hope this helps!

<!-- gh-comment-id:1990958939 --> @jmorganca commented on GitHub (Mar 12, 2024): Hi there, thanks for creating an issue. To call `/api/generate` or `/api/chat`, you need to provide the `POST` method. You can try this in two ways: 1. `ollama run codellama` will do this for you interactively 2. You can use powershell in the terminal: ``` (Invoke-WebRequest -method POST -Body '{"model":"codellama", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json ``` Hope this helps!
Author
Owner

@WiseMarius commented on GitHub (Mar 12, 2024):

Thanks for the indications, but how do I setup correctly Ollama Autocoder extension for VSCode?
The following setting
image
gives me this error
image

<!-- gh-comment-id:1990980663 --> @WiseMarius commented on GitHub (Mar 12, 2024): Thanks for the indications, but how do I setup correctly Ollama Autocoder extension for VSCode? The following setting ![image](https://github.com/ollama/ollama/assets/25198837/513f92a9-a654-4423-a5a2-b037edcdee2b) gives me this error ![image](https://github.com/ollama/ollama/assets/25198837/bebbe6ca-a355-4aa3-922f-6d6c620d26b2)
Author
Owner

@ayttop commented on GitHub (Sep 8, 2024):

PS C:\Users\ArabTech\Desktop> (Invoke-WebRequest -method POST -Body '{"model":"llama3.1.gguf:latest", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json

model : llama3.1.gguf:latest
created_at : 2024-09-08T21:39:17.5747041Z
response : I'd be happy to explain why the sky appears blue!

                   The short answer is that it's due to a phenomenon called Rayleigh scattering, named after Lord Rayleigh, who first described it in the late 19th century.

                   Here's what happens:

                   1. **Sunlight enters Earth's atmosphere**: When sunlight enters our atmosphere, it encounters tiny molecules of gases like nitrogen (N2) and oxygen (O2). These molecules are much
                   smaller than the wavelength of light.
                   2. **Scattering occurs**: As a result of this interaction, shorter wavelengths of light (like blue and violet) are scattered in all directions by these gas molecules. This is known as
                   Rayleigh scattering.

                   Think of it like this: Imagine you're at a party with tiny, mischievous fairies who love to play with light waves. They grab onto the short, energetic blue and violet light waves and
                   start bouncing them around in every direction, making them scatter everywhere!

                   3. **Longer wavelengths are unaffected**: Meanwhile, longer wavelengths of light (like red, orange, and yellow) have more energy and aren't affected as much by these tiny molecules.
                   They continue to travel in a straight line, reaching our eyes from the sun's position.

                   4. **Our atmosphere scatters blue light more than other colors**: Since shorter wavelengths are scattered more efficiently, we see a predominance of blue light being bounced around in
                   all directions. This is why the sky appears blue during the daytime when the sun is overhead (around 12:00 PM).

                   5. **Atmospheric conditions and dust affect the color**: Keep in mind that atmospheric conditions like pollution, dust, and water vapor can alter this effect. For example, if there's a
                   lot of pollution or dust in the air, it can scatter light in different ways, making the sky appear more hazy or gray.

                   Now, I know what you're thinking: "But why doesn't the sky look blue at sunrise and sunset?" Ah, that's because the sun is lower on the horizon during those times. The light has to
                   travel longer distances through the atmosphere, which scatters even more of the shorter wavelengths (like blue). As a result, we see more of the longer wavelengths (like red and
                   orange) reaching our eyes, giving us those beautiful sunset colors.

                   I hope that helps you understand why the sky appears blue! Do you have any follow-up questions or would you like me to elaborate on anything?

done : True
done_reason : stop
context : {128006, 9125, 128007, 271...}
total_duration : 126095524400
load_duration : 2651503700
prompt_eval_count : 27
prompt_eval_duration : 938038000
eval_count : 495
eval_duration : 122499980000

PS C:\Users\ArabTech\Desktop>

<!-- gh-comment-id:2336832925 --> @ayttop commented on GitHub (Sep 8, 2024): PS C:\Users\ArabTech\Desktop> (Invoke-WebRequest -method POST -Body '{"model":"llama3.1.gguf:latest", "prompt":"Why is the sky blue?", "stream": false}' -uri http://localhost:11434/api/generate ).Content | ConvertFrom-json model : llama3.1.gguf:latest created_at : 2024-09-08T21:39:17.5747041Z response : I'd be happy to explain why the sky appears blue! The short answer is that it's due to a phenomenon called Rayleigh scattering, named after Lord Rayleigh, who first described it in the late 19th century. Here's what happens: 1. **Sunlight enters Earth's atmosphere**: When sunlight enters our atmosphere, it encounters tiny molecules of gases like nitrogen (N2) and oxygen (O2). These molecules are much smaller than the wavelength of light. 2. **Scattering occurs**: As a result of this interaction, shorter wavelengths of light (like blue and violet) are scattered in all directions by these gas molecules. This is known as Rayleigh scattering. Think of it like this: Imagine you're at a party with tiny, mischievous fairies who love to play with light waves. They grab onto the short, energetic blue and violet light waves and start bouncing them around in every direction, making them scatter everywhere! 3. **Longer wavelengths are unaffected**: Meanwhile, longer wavelengths of light (like red, orange, and yellow) have more energy and aren't affected as much by these tiny molecules. They continue to travel in a straight line, reaching our eyes from the sun's position. 4. **Our atmosphere scatters blue light more than other colors**: Since shorter wavelengths are scattered more efficiently, we see a predominance of blue light being bounced around in all directions. This is why the sky appears blue during the daytime when the sun is overhead (around 12:00 PM). 5. **Atmospheric conditions and dust affect the color**: Keep in mind that atmospheric conditions like pollution, dust, and water vapor can alter this effect. For example, if there's a lot of pollution or dust in the air, it can scatter light in different ways, making the sky appear more hazy or gray. Now, I know what you're thinking: "But why doesn't the sky look blue at sunrise and sunset?" Ah, that's because the sun is lower on the horizon during those times. The light has to travel longer distances through the atmosphere, which scatters even more of the shorter wavelengths (like blue). As a result, we see more of the longer wavelengths (like red and orange) reaching our eyes, giving us those beautiful sunset colors. I hope that helps you understand why the sky appears blue! Do you have any follow-up questions or would you like me to elaborate on anything? done : True done_reason : stop context : {128006, 9125, 128007, 271...} total_duration : 126095524400 load_duration : 2651503700 prompt_eval_count : 27 prompt_eval_duration : 938038000 eval_count : 495 eval_duration : 122499980000 PS C:\Users\ArabTech\Desktop>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1891