Skip to content

Commit

Permalink
update agent
Browse files Browse the repository at this point in the history
  • Loading branch information
qingzhong1 committed Jan 2, 2024
1 parent 4b1d9d5 commit d0bdcee
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from tools.prompt_utils import EB_EDIT_TEMPLATE, eb_functions
from tools.utils import erniebot_chat, json_correct, write_to_json

from erniebot_agent.agents.base import Agent
from erniebot_agent.agents.agent import Agent
from erniebot_agent.prompt import PromptTemplate


Expand All @@ -14,7 +14,7 @@ class EditorActorAgent(Agent):
def __init__(
self,
name: str,
llm: str = "ernie-bot-4",
llm: str = "ernie-4.0",
system_message: Optional[str] = None,
config: list = [],
save_log_path=None,
Expand All @@ -26,7 +26,7 @@ def __init__(
self.save_log_path = save_log_path
self.prompt = PromptTemplate(" 草稿为:\n\n{{report}}", input_variables=["report"])

async def _async_run(self, report):
async def _run(self, report):
messages = [
{
"role": "user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from tools.prompt_utils import prompt_markdow
from tools.utils import erniebot_chat, write_to_json

from erniebot_agent.agents.base import Agent
from erniebot_agent.agents.agent import Agent


class RankingAgent(Agent):
Expand All @@ -27,7 +27,7 @@ def __init__(
self.save_log_path = save_log_path
self.is_reset = False

async def _async_run(self, list_reports, query):
async def _run(self, list_reports, query):
reports = []
for item in list_reports:
if self.check_format(item):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from tools.utils import add_citation, erniebot_chat, write_to_json

from erniebot_agent.agents.base import Agent
from erniebot_agent.agents.agent import Agent
from erniebot_agent.prompt import PromptTemplate

SUMMARIZE_MAX_LENGTH = 1800
Expand Down Expand Up @@ -97,7 +97,7 @@ async def run_search_summary(self, query):
# write_to_json(f"{self.dir_path}/research-{query}.jsonl", responses)
return responses, url_dict

async def _async_run(self, query):
async def _run(self, query):
"""
Runs the ResearchAgent
Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from tools.utils import erniebot_chat, write_to_json

from erniebot_agent.agents.base import Agent
from erniebot_agent.agents.agent import Agent
from erniebot_agent.prompt.prompt_template import PromptTemplate


Expand All @@ -14,7 +14,7 @@ class ReviserActorAgent(Agent):
def __init__(
self,
name: str,
llm: str = "erine-bot-4",
llm: str = "erine-4.0",
system_message: Optional[str] = None,
config: list = [],
save_log_path=None,
Expand All @@ -27,7 +27,7 @@ def __init__(
self.config = config
self.save_log_path = save_log_path

async def _async_run(self, draft, notes):
async def _run(self, draft, notes):
messages = [
{
"role": "user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def __call__(
result = erniebot_chat(messages=messages, temperature=1e-10)
else:
result = erniebot_chat(
messages=messages, temperature=1e-10, model="ernie-bot-8k"
messages=messages, temperature=1e-10, model="ernie-longtext"
)
l_index = result.index("{")
r_index = result.rindex("}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def erniebot_chat(messages: list, functions: Optional[str] = None, model: Optional[str] = None, **kwargs):
if not model:
model = "ernie-bot-4"
model = "ernie-4.0"
_config = dict(
api_type=api_type,
access_token=access_token,
Expand All @@ -30,7 +30,7 @@ def erniebot_chat(messages: list, functions: Optional[str] = None, model: Option
return resp_stream["result"]


def call_function(action: str, agent_role_prompt: str, model="ernie-bot-8k", **kwargs):
def call_function(action: str, agent_role_prompt: str, model="ernie-longtext", **kwargs):
messages = [
{
"role": "user",
Expand Down

0 comments on commit d0bdcee

Please sign in to comment.