Files
zjdataai-app/backend/app/engine/model/siliconCloudOpenAI.py
T

19 lines
705 B
Python

from llama_index.llms.openai import OpenAI
from llama_index.core.base.llms.types import LLMMetadata
import os
class SiliconCloudOpenAI(OpenAI):
@property
def metadata(self) -> LLMMetadata:
bIsChat = os.getenv('IS_CHAT_MODEL')
bIsFuncall = os.getenv('IS_FUN_CALL_MODEL')
bIsChat = True if bIsChat.lower() in ['true','1'] else False
bIsFuncall = True if bIsFuncall.lower() in ['true','1'] else False
return LLMMetadata(
context_window= int(os.getenv('CONTEXT_WINDOW')),
num_output=self.max_tokens or -1,
is_chat_model=bIsChat,
is_function_calling_model=bIsFuncall,
model_name=self.model,
)