Jarvis use gpt-3.5
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
instance_id = "Jarvis"
|
instance_id = "Jarvis"
|
||||||
fullname = "Jarvis"
|
fullname = "Jarvis"
|
||||||
|
llm_model_name = "gpt-3.5-turbo-16k-0613"
|
||||||
|
|
||||||
[[prompt]]
|
[[prompt]]
|
||||||
role = "system"
|
role = "system"
|
||||||
|
|||||||
@@ -248,6 +248,14 @@ class AIAgent:
|
|||||||
async def _get_agent_prompt(self) -> AgentPrompt:
|
async def _get_agent_prompt(self) -> AgentPrompt:
|
||||||
return self.prompt
|
return self.prompt
|
||||||
|
|
||||||
|
def _format_msg_by_env_value(self,prompt:AgentPrompt):
|
||||||
|
if self.owner_env is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
for msg in prompt.messages:
|
||||||
|
old_content = msg.get("content")
|
||||||
|
msg["content"] = old_content.format_map(self.owner_env)
|
||||||
|
|
||||||
async def _process_msg(self,msg:AgentMsg) -> AgentMsg:
|
async def _process_msg(self,msg:AgentMsg) -> AgentMsg:
|
||||||
from .compute_kernel import ComputeKernel
|
from .compute_kernel import ComputeKernel
|
||||||
from .bus import AIBus
|
from .bus import AIBus
|
||||||
@@ -269,6 +277,7 @@ class AIAgent:
|
|||||||
msg_prompt.messages = [{"role":"user","content":msg.body}]
|
msg_prompt.messages = [{"role":"user","content":msg.body}]
|
||||||
prompt.append(msg_prompt)
|
prompt.append(msg_prompt)
|
||||||
|
|
||||||
|
self._format_msg_by_env_value(prompt)
|
||||||
inner_functions = self._get_inner_functions()
|
inner_functions = self._get_inner_functions()
|
||||||
|
|
||||||
task_result:ComputeTaskResult = await ComputeKernel.get_instance().do_llm_completion(prompt,self.llm_model_name,self.max_token_size,inner_functions)
|
task_result:ComputeTaskResult = await ComputeKernel.get_instance().do_llm_completion(prompt,self.llm_model_name,self.max_token_size,inner_functions)
|
||||||
|
|||||||
@@ -167,8 +167,12 @@ class OpenAI_ComputeNode(ComputeNode):
|
|||||||
|
|
||||||
def is_support(self, task: ComputeTask) -> bool:
|
def is_support(self, task: ComputeTask) -> bool:
|
||||||
if task.task_type == ComputeTaskType.LLM_COMPLETION:
|
if task.task_type == ComputeTaskType.LLM_COMPLETION:
|
||||||
if not task.params["model_name"] or task.params["model_name"] == "gpt-4-0613":
|
if not task.params["model_name"]:
|
||||||
return True
|
return True
|
||||||
|
model_name : str = task.params["model_name"]
|
||||||
|
if model_name.startswith("gpt-"):
|
||||||
|
return True
|
||||||
|
|
||||||
if task.task_type == ComputeTaskType.TEXT_EMBEDDING:
|
if task.task_type == ComputeTaskType.TEXT_EMBEDDING:
|
||||||
if task.params["model_name"] == "text-embedding-ada-002":
|
if task.params["model_name"] == "text-embedding-ada-002":
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ async def main():
|
|||||||
|
|
||||||
await asyncio.sleep(0.2)
|
await asyncio.sleep(0.2)
|
||||||
while True:
|
while True:
|
||||||
user_input = await session.prompt_async(f"{shell.username}<->{shell.current_topic}@{shell.current_target}$",completer=completer,style=shell_style)
|
user_input = await session.prompt_async(f"{shell.username}<->{shell.current_topic}@{shell.current_target}$ ",completer=completer,style=shell_style)
|
||||||
if len(user_input) <= 1:
|
if len(user_input) <= 1:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user