11from collections .abc import Sequence
2- from typing import Generic , Optional , TypeVar , Union
2+ from typing import Generic , Optional , TypeVar
33
44from pydantic import Field
55
1010
1111class Item (StandardBaseModel , Generic [PromptT ]):
1212 """
13- Represents a single item in a dataset, containing a prompt and its associated metadata.
13+ Represents a single item in a dataset,
14+ containing a prompt and its associated metadata.
1415 """
1516
1617 value : PromptT = Field (
@@ -33,11 +34,13 @@ class ItemList(Sequence[Item[PromptT]]):
3334 Represents a list of items, each containing a prompt and its metadata.
3435 """
3536
37+ shared_prefix : Optional [PromptT ]
38+
3639 def __init__ (self , * items : Item [PromptT ], shared_prefix : Optional [PromptT ] = None ):
37- self .shared_prefix : Optional [ PromptT ] = shared_prefix
38- self ._items : list [ Item [ PromptT ]] = list (items )
40+ self .shared_prefix = shared_prefix
41+ self ._items = list (items )
3942
40- def __getitem__ (self , key ) -> Union [ Item [ PromptT ], Sequence [ Item [ PromptT ]]] :
43+ def __getitem__ (self , key ):
4144 return self ._items [key ]
4245
4346 def __len__ (self ) -> int :
0 commit comments