MCPcopy Index your code
hub / github.com/ollama/ollama-python / stream_handler

Function stream_handler

tests/test_client.py:103–119  ·  view source on GitHub ↗
(_: Request)

Source from the content-addressed store, hash-verified

101
102def test_client_chat_stream(httpserver: HTTPServer):
103 def stream_handler(_: Request):
104 def generate():
105 for message in ['I ', "don't ", 'know.']:
106 yield (
107 json.dumps(
108 {
109 'model': 'dummy',
110 'message': {
111 'role': 'assistant',
112 'content': message,
113 },
114 }
115 )
116 + '\n'
117 )
118
119 return Response(generate())
120
121 httpserver.expect_ordered_request(
122 '/api/chat',

Callers

nothing calls this directly

Calls 1

generateFunction · 0.85

Tested by

no test coverage detected