MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / stream_generate

Method stream_generate

paperflow/providers/llm.py:234–254  ·  view source on GitHub ↗
(
        self,
        prompt: str,
        *,
        system: Optional[str] = None,
        temperature: float = 0.0,
        max_tokens: int = 1024,
    )

Source from the content-addressed store, hash-verified

232 )
233
234 def stream_generate(
235 self,
236 prompt: str,
237 *,
238 system: Optional[str] = None,
239 temperature: float = 0.0,
240 max_tokens: int = 1024,
241 ) -> Iterator[str]:
242 kwargs = {
243 "model": self.model,
244 "max_tokens": max_tokens,
245 "temperature": temperature,
246 "messages": [{"role": "user", "content": prompt}],
247 }
248 if system:
249 kwargs["system"] = system
250
251 with self._client.messages.stream(**kwargs) as stream:
252 for text in stream.text_stream:
253 if text:
254 yield text
255
256
257class OllamaLLM:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected