(
self,
prompt: str,
*,
system: Optional[str] = None,
temperature: float = 0.0,
max_tokens: int = 1024,
)
| 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 | |
| 257 | class OllamaLLM: |
nothing calls this directly
no outgoing calls
no test coverage detected