community[patch]: docstrings (#16810)

- added missed docstrings
- formated docstrings to the consistent form
This commit is contained in:
Leonid Ganeline
2024-02-09 12:48:57 -08:00
committed by GitHub
parent ae66bcbc10
commit 932c52c333
25 changed files with 66 additions and 18 deletions

View File

@@ -40,25 +40,33 @@ async def aenumerate(
class IndexableBaseModel(BaseModel):
"""Allows a BaseModel to return its fields by string variable indexing"""
"""Allows a BaseModel to return its fields by string variable indexing."""
def __getitem__(self, item: str) -> Any:
return getattr(self, item)
class Choice(IndexableBaseModel):
"""Choice."""
message: dict
class ChatCompletions(IndexableBaseModel):
"""Chat completions."""
choices: List[Choice]
class ChoiceChunk(IndexableBaseModel):
"""Choice chunk."""
delta: dict
class ChatCompletionChunk(IndexableBaseModel):
"""Chat completion chunk."""
choices: List[ChoiceChunk]
@@ -301,7 +309,7 @@ def convert_messages_for_finetuning(
class Completions:
"""Completion."""
"""Completions."""
@overload
@staticmethod
@@ -399,6 +407,8 @@ class Completions:
class Chat:
"""Chat."""
def __init__(self) -> None:
self.completions = Completions()