|
|
@ -48,14 +48,11 @@ def get_model_and_provider(model : Union[Model, str],
|
|
|
|
|
|
|
|
|
|
|
|
class ChatCompletion:
|
|
|
|
class ChatCompletion:
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def create(
|
|
|
|
def create(model: Union[Model, str],
|
|
|
|
model: Union[Model, str],
|
|
|
|
|
|
|
|
messages : Messages,
|
|
|
|
messages : Messages,
|
|
|
|
provider : Union[type[BaseProvider], None] = None,
|
|
|
|
provider : Union[type[BaseProvider], None] = None,
|
|
|
|
stream : bool = False,
|
|
|
|
stream : bool = False,
|
|
|
|
auth : Union[str, None] = None,
|
|
|
|
auth : Union[str, None] = None, **kwargs) -> Union[CreateResult, str]:
|
|
|
|
**kwargs
|
|
|
|
|
|
|
|
) -> Union[CreateResult, str]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model, provider = get_model_and_provider(model, provider, stream)
|
|
|
|
model, provider = get_model_and_provider(model, provider, stream)
|
|
|
|
|
|
|
|
|
|
|
@ -71,12 +68,11 @@ class ChatCompletion:
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
async def create_async(
|
|
|
|
async def create_async(
|
|
|
|
model: Union[Model, str],
|
|
|
|
model : Union[Model, str],
|
|
|
|
messages: Messages,
|
|
|
|
messages: Messages,
|
|
|
|
provider: Union[type[BaseProvider], None] = None,
|
|
|
|
provider: Union[type[BaseProvider], None] = None,
|
|
|
|
stream: bool = False,
|
|
|
|
stream : bool = False, **kwargs) -> str:
|
|
|
|
**kwargs
|
|
|
|
|
|
|
|
) -> str:
|
|
|
|
|
|
|
|
if stream:
|
|
|
|
if stream:
|
|
|
|
raise ValueError(f'"create_async" does not support "stream" argument')
|
|
|
|
raise ValueError(f'"create_async" does not support "stream" argument')
|
|
|
|
|
|
|
|
|
|
|
|