优化属性图检索功能及支持OpenAI线上模型
This commit is contained in:
@@ -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,
|
||||
)
|
||||
Reference in New Issue
Block a user