优化属性图检索功能及支持OpenAI线上模型

This commit is contained in:
wanyaokun
2024-09-20 17:34:38 +08:00
parent 092f7230c1
commit f7260da6d9
12 changed files with 350 additions and 76 deletions
@@ -0,0 +1,19 @@
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,
)