-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from KTC-Security-Circle/fix/response
Fix/response
- Loading branch information
Showing
12 changed files
with
398 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from langchain_openai import AzureChatOpenAI | ||
|
||
from sc_system_ai.agents.tools import magic_function | ||
from sc_system_ai.template.agent import Agent | ||
from sc_system_ai.template.ai_settings import llm | ||
from sc_system_ai.template.user_prompts import User | ||
|
||
main_agent_tools = [magic_function] | ||
main_agent_info = """あなたの役割はユーザーと雑談を行うことです。 | ||
ユーザーが楽しめるような会話になるようにしてください。 | ||
""" | ||
|
||
# agentクラスの作成 | ||
|
||
|
||
class SmallTalkAgent(Agent): | ||
def __init__( | ||
self, | ||
llm: AzureChatOpenAI = llm, | ||
user_info: User | None = None, | ||
): | ||
super().__init__( | ||
llm=llm, | ||
user_info=user_info if user_info is not None else User(), | ||
) | ||
self.assistant_info = main_agent_info | ||
super().set_assistant_info(self.assistant_info) | ||
super().set_tools(main_agent_tools) | ||
|
||
|
||
if __name__ == "__main__": | ||
from sc_system_ai.logging_config import setup_logging | ||
setup_logging() | ||
# ユーザー情報 | ||
user_name = "hogehoge" | ||
user_major = "fugafuga専攻" | ||
history = [ | ||
("human", "こんにちは!"), | ||
("ai", "本日はどのようなご用件でしょうか?") | ||
] | ||
user_info = User(name=user_name, major=user_major) | ||
user_info.conversations.add_conversations_list(history) | ||
|
||
agent = SmallTalkAgent(user_info=user_info) | ||
agent.display_agent_info() | ||
# print(main_agent.get_agent_prompt()) | ||
agent.display_agent_prompt() | ||
print(agent.invoke("magic function に3をいれて")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import logging | ||
|
||
from sc_system_ai.agents.small_talk_agent import SmallTalkAgent | ||
from sc_system_ai.template.calling_agent import CallingAgent | ||
from sc_system_ai.template.user_prompts import User | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class CallingSmallTalkAgent(CallingAgent): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
self.set_tool_info( | ||
name="calling_small_talk_agent", | ||
description="雑談エージェントを呼び出すツール", | ||
agent=SmallTalkAgent, | ||
) | ||
|
||
calling_small_talk_agent = CallingSmallTalkAgent() | ||
|
||
if __name__ == "__main__": | ||
from sc_system_ai.logging_config import setup_logging | ||
setup_logging() | ||
|
||
calling_small_talk_agent.set_user_info(User(name="hogehoge", major="fugafuga専攻")) | ||
print(calling_small_talk_agent.invoke({"user_input": "こんにちは"})) |
Oops, something went wrong.