|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
"""__ModuleName__ chat models."""
|
|
|
|
|
|
|
|
|
|
from typing import Any, AsyncIterator, Iterator, List, Optional
|
|
|
|
|
|
|
|
|
|
from langchain_core.callbacks import (
|
|
|
|
@ -29,6 +30,7 @@ class Chat__ModuleName__(BaseChatModel):
|
|
|
|
|
"""Return type of chat model."""
|
|
|
|
|
return "chat-__package_name_short__"
|
|
|
|
|
|
|
|
|
|
# TODO: This method must be implemented to generate chat responses.
|
|
|
|
|
def _generate(
|
|
|
|
|
self,
|
|
|
|
|
messages: List[BaseMessage],
|
|
|
|
@ -38,7 +40,7 @@ class Chat__ModuleName__(BaseChatModel):
|
|
|
|
|
) -> ChatResult:
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
|
# TODO: Implement if __model_name__ supports streaming. Otherwise delete method.
|
|
|
|
|
# TODO: Implement if Chat__ModuleName__ supports streaming. Otherwise delete method.
|
|
|
|
|
def _stream(
|
|
|
|
|
self,
|
|
|
|
|
messages: List[BaseMessage],
|
|
|
|
@ -48,7 +50,7 @@ class Chat__ModuleName__(BaseChatModel):
|
|
|
|
|
) -> Iterator[ChatGenerationChunk]:
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
|
# TODO: Implement if __model_name__ supports async streaming. Otherwise delete
|
|
|
|
|
# TODO: Implement if Chat__ModuleName__ supports async streaming. Otherwise delete
|
|
|
|
|
# method.
|
|
|
|
|
async def _astream(
|
|
|
|
|
self,
|
|
|
|
@ -59,7 +61,7 @@ class Chat__ModuleName__(BaseChatModel):
|
|
|
|
|
) -> AsyncIterator[ChatGenerationChunk]:
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
|
# TODO: Implement if __model_name__ supports async generation. Otherwise delete
|
|
|
|
|
# TODO: Implement if Chat__ModuleName__ supports async generation. Otherwise delete
|
|
|
|
|
# method.
|
|
|
|
|
async def _agenerate(
|
|
|
|
|
self,
|
|
|
|
|