You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We see the definition of generate() in client file, there's a context that should be Sequence[int]:
def generate(
self,
model: str = '',
prompt: Optional[str] = None,
suffix: Optional[str] = None,
*,
system: Optional[str] = None,
template: Optional[str] = None,
context: Optional[Sequence[int]] = None,
stream: bool = False,
raw: Optional[bool] = None,
format: Optional[Union[Literal['', 'json'], JsonSchemaValue]] = None,
images: Optional[Sequence[Union[str, bytes]]] = None,
options: Optional[Union[Mapping[str, Any], Options]] = None,
keep_alive: Optional[Union[float, str]] = None,
) -> Union[GenerateResponse, Iterator[GenerateResponse]]:
"""
Create a response using the requested model.
Raises `RequestError` if a model is not provided.
Raises `ResponseError` if the request could not be fulfilled.
Returns `GenerateResponse` if `stream` is `False`, otherwise returns a `GenerateResponse` generator.
"""
return self._request(
GenerateResponse,
'POST',
'/api/generate',
json=GenerateRequest(
model=model,
prompt=prompt,
suffix=suffix,
system=system,
template=template,
context=context,
stream=stream,
raw=raw,
format=format,
images=[image for image in _copy_images(images)] if images else None,
options=options,
keep_alive=keep_alive,
).model_dump(exclude_none=True),
stream=stream,
)
class GenerateResponse(BaseGenerateResponse):
"""
Response returned by generate requests.
"""
response: str
'Response content. When streaming, this contains a fragment of the response.'
context: Optional[Sequence[int]] = None
'Tokenized history up to the point of the response.'
But how can our text be tokenized into the int? Is there such a function inside this ollama libriary?
The text was updated successfully, but these errors were encountered:
We see the definition of generate() in client file, there's a context that should be Sequence[int]:
But how can our text be tokenized into the int? Is there such a function inside this ollama libriary?
The text was updated successfully, but these errors were encountered: