generated from Sunwood-ai-labs/HarmonAI_III
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
537 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.git | ||
__pycache__ | ||
LICENSE | ||
output.md | ||
assets | ||
Style-Bert-VITS2 | ||
output | ||
streamlit | ||
SourceSage.md | ||
data | ||
.gitignore | ||
.SourceSageignore | ||
*.png | ||
Changelog | ||
SourceSageAssets | ||
SourceSageAssetsDemo | ||
__pycache__ | ||
.pyc | ||
**/__pycache__/** | ||
modules\__pycache__ | ||
.svg | ||
sourcesage.egg-info | ||
.pytest_cache | ||
dist | ||
build | ||
.env | ||
example | ||
|
||
.gaiah.md | ||
.Gaiah.md | ||
tmp.md | ||
tmp2.md | ||
.SourceSageAssets | ||
tests | ||
template | ||
aira.egg-info | ||
aira.Gaiah.md | ||
README_template.md | ||
|
||
egg-info | ||
oasis_article.egg-info | ||
.harmon_ai | ||
.aira | ||
|
||
article_draft | ||
issue_creator.log | ||
oasis.log | ||
|
||
debug_output | ||
*.log | ||
|
||
html_replacement1.html | ||
html_raw.html | ||
html_content.html | ||
html_with_placeholders.html | ||
markdown_html.html | ||
markdown_text.md | ||
markdown_text2.md | ||
|
||
saved_article.html | ||
memo.md | ||
content.md | ||
|
||
.SourceSageAssets | ||
docs | ||
.github | ||
.venv | ||
*.json | ||
src |
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,33 @@ | ||
.git | ||
__pycache__ | ||
LICENSE | ||
output.md | ||
assets | ||
Style-Bert-VITS2 | ||
output | ||
streamlit | ||
SourceSage.md | ||
data | ||
.gitignore | ||
.SourceSageignore | ||
*.png | ||
Changelog | ||
SourceSageAssets | ||
SourceSageAssetsDemo | ||
__pycache__ | ||
.pyc | ||
**/__pycache__/** | ||
modules\__pycache__ | ||
.svg | ||
sourcesage.egg-info | ||
.pytest_cache | ||
dist | ||
build | ||
ollama-webui | ||
langfuse | ||
.env | ||
.SourceSageignore | ||
.SourceSageAssets | ||
.Gaiah.md | ||
spellbook | ||
eval_results |
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 |
---|---|---|
@@ -1,55 +1,56 @@ | ||
# Airline customer service | ||
# Swarm airline: 航空会社カスタマーサービス | ||
|
||
This example demonstrates a multi-agent setup for handling different customer service requests in an airline context using the Swarm framework. The agents can triage requests, handle flight modifications, cancellations, and lost baggage cases. | ||
This example uses the helper function `run_demo_loop`, which allows us to create an interactive Swarm session. | ||
![](https://raw.githubusercontent.com/Sunwood-ai-labs/swarm-sample-box/refs/heads/main/docs/Sample01.png) | ||
|
||
## Agents | ||
このサンプルは、Swarmフレームワークを使用して航空会社のコンテキストにおける様々な顧客サービスリクエストを処理するマルチエージェントセットアップを示しています。エージェントはリクエストの振り分け、フライト変更、キャンセル、手荷物紛失ケースを処理できます。 | ||
このサンプルでは、対話式のSwarmセッションを作成できる`run_demo_loop`ヘルパー関数を使用しています。 | ||
|
||
1. **Triage Agent**: Determines the type of request and transfers to the appropriate agent. | ||
2. **Flight Modification Agent**: Handles requests related to flight modifications, further triaging them into: | ||
- **Flight Cancel Agent**: Manages flight cancellation requests. | ||
- **Flight Change Agent**: Manages flight change requests. | ||
3. **Lost Baggage Agent**: Handles lost baggage inquiries. | ||
## エージェント | ||
|
||
## Setup | ||
1. **振り分けエージェント**: リクエストの種類を判断し、適切なエージェントに転送します。 | ||
2. **フライト変更エージェント**: フライト変更に関するリクエストを処理し、さらに以下に振り分けます: | ||
- **フライトキャンセルエージェント**: フライトキャンセルリクエストを管理します。 | ||
- **フライト変更エージェント**: フライト変更リクエストを管理します。 | ||
3. **手荷物紛失エージェント**: 手荷物紛失の問い合わせを処理します。 | ||
|
||
Once you have installed dependencies and Swarm, run the example using: | ||
## セットアップ | ||
|
||
依存関係とSwarmをインストールしたら、以下のコマンドでサンプルを実行します: | ||
|
||
```shell | ||
python3 main.py | ||
``` | ||
|
||
## Evaluations | ||
## 評価 | ||
|
||
> [!NOTE] | ||
> These evals are intended to be examples to demonstrate functionality, but will have to be updated and catered to your particular use case. | ||
> これらの評価は機能性を示すためのサンプルですが、特定のユースケースに合わせて更新・調整する必要があります。 | ||
For this example, we run function evals, where we input a conversation, and the expected function call ('None' if no function call is expected). | ||
The evaluation cases are stored in `eval/eval_cases/` subfolder. | ||
このサンプルでは、会話と予想される関数呼び出し(関数呼び出しが予想されない場合は'None')を入力とする機能評価を実行します。 | ||
評価ケースは`eval/eval_cases/`サブフォルダに保存されています。 | ||
|
||
```json | ||
[ | ||
{ | ||
"conversation": [ | ||
{ "role": "user", "content": "My bag was not delivered!" } | ||
{ "role": "user", "content": "私の荷物が届きませんでした!" } | ||
], | ||
"function": "transfer_to_lost_baggage" | ||
}, | ||
{ | ||
"conversation": [ | ||
{ "role": "user", "content": "I had some turbulence on my flight" } | ||
{ "role": "user", "content": "フライト中に乱気流がありました" } | ||
], | ||
"function": "None" | ||
} | ||
] | ||
``` | ||
|
||
The script 'function_evals.py' will run the evals. Make sure to set `n` to the number | ||
of times you want to run each particular eval. To run the script from the root airline folder, execute: | ||
'function_evals.py'スクリプトが評価を実行します。特定の評価を実行したい回数を`n`に設定してください。ルートの航空会社フォルダからスクリプトを実行するには、以下のコマンドを実行します: | ||
|
||
```bash | ||
cd evals | ||
python3 function_evals.py | ||
python function_evals.py | ||
``` | ||
|
||
The results of these evaluations will be stored in `evals/eval_results/` | ||
これらの評価の結果は`evals/eval_results/`に保存されます。 |
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 |
---|---|---|
@@ -1,28 +1,36 @@ | ||
# 人間のエージェントにエスカレーション | ||
def escalate_to_agent(reason=None): | ||
return f"Escalating to agent: {reason}" if reason else "Escalating to agent" | ||
|
||
return f"エージェントにエスカレーション: {reason}" if reason else "エージェントにエスカレーション" | ||
|
||
# フライト変更が可能か確認 | ||
def valid_to_change_flight(): | ||
return "Customer is eligible to change flight" | ||
|
||
return "顧客はフライト変更の資格があります" | ||
|
||
# フライト変更を実行 | ||
def change_flight(): | ||
return "Flight was successfully changed!" | ||
|
||
return "フライトの変更が成功しました!" | ||
|
||
# 返金プロセスを開始 | ||
def initiate_refund(): | ||
status = "Refund initiated" | ||
status = "返金が開始されました" | ||
return status | ||
|
||
|
||
# フライトクレジットの発行を開始 | ||
def initiate_flight_credits(): | ||
status = "Successfully initiated flight credits" | ||
status = "フライトクレジットが正常に開始されました" | ||
return status | ||
|
||
|
||
# ケースを解決済みとしてマーク | ||
def case_resolved(): | ||
return "Case resolved. No further questions." | ||
|
||
return "ケースが解決しました。これ以上の質問はありません。" | ||
|
||
# 手荷物の捜索プロセスを開始 | ||
def initiate_baggage_search(): | ||
return "Baggage was found!" | ||
return "手荷物が見つかりました!" | ||
|
||
# 解説: | ||
# このファイルでは、エージェントが使用できる各種ツール(関数)を定義しています。 | ||
# これらの関数は、実際のシステムでは外部APIの呼び出しやデータベース操作などを行うことになりますが、 | ||
# このデモでは簡単な文字列を返すだけの実装になっています。 | ||
# 各関数は特定の顧客サービスタスク(エスカレーション、フライト変更、返金など)に対応しており、 | ||
# エージェントはこれらの関数を呼び出すことで、顧客のリクエストを処理します。 |
20 changes: 20 additions & 0 deletions
20
examples/airline/evals/eval_cases/flight_modification_cases_JP.json
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,20 @@ | ||
[ | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "フライトを1日早く変更したいです!"} | ||
], | ||
"function": "transfer_to_flight_change" | ||
}, | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "フライトをキャンセルしたいです。個人的な都合で行けなくなってしまいました"} | ||
], | ||
"function": "transfer_to_flight_cancel" | ||
}, | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "このフライトはもう必要ありません"} | ||
], | ||
"function": "None" | ||
} | ||
] |
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 @@ | ||
[ | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "私の荷物が届いていません!"} | ||
], | ||
"function": "transfer_to_lost_baggage" | ||
}, | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "フライト中に乱気流がありました"} | ||
], | ||
"function": "None" | ||
}, | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "フライトをキャンセルしたいのですが"} | ||
], | ||
"function": "transfer_to_flight_modification" | ||
}, | ||
{ | ||
"conversation": [ | ||
{"role": "user", "content": "人生の意味は何ですか"} | ||
], | ||
"function": "None" | ||
} | ||
] |
Oops, something went wrong.