mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-18 04:01:02 +00:00
Better type hint for iter_prompt method
The Generator thing is only useful if the method uses the send mechanism Declaring it an Iterator gives people more flexibility for how they implement it.
This commit is contained in:
parent
9a180e65a8
commit
7054c673e1
1 changed files with 3 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Any, Dict, Generator, Optional, Set
|
||||
from typing import Any, Dict, Iterator, Optional, Set
|
||||
from abc import ABC, abstractmethod
|
||||
import os
|
||||
from pydantic import ConfigDict, BaseModel
|
||||
|
|
@ -55,7 +55,8 @@ class Response(ABC):
|
|||
self._done = True
|
||||
|
||||
@abstractmethod
|
||||
def iter_prompt(self) -> Generator[str, None, None]:
|
||||
def iter_prompt(self) -> Iterator[str]:
|
||||
"Execute prompt and yield chunks of text, or yield a single big chunk"
|
||||
pass
|
||||
|
||||
def _force(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue