Initial commit
This commit is contained in:
commit
db896255d6
744 changed files with 56028 additions and 0 deletions
20
api/core/llm/streamable_open_ai.py
Normal file
20
api/core/llm/streamable_open_ai.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from langchain.schema import LLMResult
|
||||
from typing import Optional, List
|
||||
from langchain import OpenAI
|
||||
|
||||
from core.llm.error_handle_wraps import handle_llm_exceptions, handle_llm_exceptions_async
|
||||
|
||||
|
||||
class StreamableOpenAI(OpenAI):
|
||||
|
||||
@handle_llm_exceptions
|
||||
def generate(
|
||||
self, prompts: List[str], stop: Optional[List[str]] = None
|
||||
) -> LLMResult:
|
||||
return super().generate(prompts, stop)
|
||||
|
||||
@handle_llm_exceptions_async
|
||||
async def agenerate(
|
||||
self, prompts: List[str], stop: Optional[List[str]] = None
|
||||
) -> LLMResult:
|
||||
return await super().agenerate(prompts, stop)
|
||||
Loading…
Add table
Add a link
Reference in a new issue