Open
Description
This simple chat example fails:
from ollama import chat
messages = [
{
'role': 'user',
'content': 'Why is the sky blue?',
},
]
response = chat('llama3.2:3b', messages=messages)
print(response['message']['content'])
httpx.ConnectError: [WinError 10049] The requested address is not valid in its context
But this works fine:
from ollama import Client
client = Client(
host='http://localhost:11434',
headers={'x-some-header': 'some-value'}
)
response = client.chat(model='llama3.2:3b', messages=[
{
'role': 'user',
'content': 'Why is the sky blue?',
},
])
print(response['message']['content'])
# or access fields directly from the response object
print(response.message.content)
The sky appears blue because of a phenomenon called scattering, which occurs when sunlight interacts with the tiny molecules of gases in the Earth's atmosphere.....
Metadata
Metadata
Assignees
Labels
No labels