Jarvis use gpt-3.5

This commit is contained in:
Liu Zhicong
2023-09-20 02:23:46 -07:00
parent a75857a631
commit d5073cc21b
4 changed files with 16 additions and 2 deletions
+9
View File
@@ -248,6 +248,14 @@ class AIAgent:
async def _get_agent_prompt(self) -> AgentPrompt:
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:
from .compute_kernel import ComputeKernel
from .bus import AIBus
@@ -269,6 +277,7 @@ class AIAgent:
msg_prompt.messages = [{"role":"user","content":msg.body}]
prompt.append(msg_prompt)
self._format_msg_by_env_value(prompt)
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)
+5 -1
View File
@@ -167,8 +167,12 @@ class OpenAI_ComputeNode(ComputeNode):
def is_support(self, task: ComputeTask) -> bool:
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
model_name : str = task.params["model_name"]
if model_name.startswith("gpt-"):
return True
if task.task_type == ComputeTaskType.TEXT_EMBEDDING:
if task.params["model_name"] == "text-embedding-ada-002":
return True
+1 -1
View File
@@ -409,7 +409,7 @@ async def main():
await asyncio.sleep(0.2)
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:
continue