
* udpaet * update * Update docs/source/ja/autoclass_tutorial.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * add codes workflows/build_pr_documentation.yml * Create preprocessing.md * added traning.md * Create Model_sharing.md * add quicktour.md * new * ll * Create benchmark.md * Create Tensorflow_model * add * add community.md * add create_a_model * create custom_model.md * create_custom_tools.md * create fast_tokenizers.md * create * add * Update docs/source/ja/_toctree.yml Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * md * add * commit * add * h * Update docs/source/ja/peft.md Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com> * Update docs/source/ja/_toctree.yml Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com> * Update docs/source/ja/_toctree.yml Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com> * Suggested Update * add perf_train_gpu_one.md * added perf based MD files * Modify toctree.yml and Add transmartion to md codes * Add `serialization.md` and edit `_toctree.yml` * add task summary and tasks explained * Add and Modify files starting from T * Add testing.md * Create main_classes files * delete main_classes folder * Add toctree.yml * Update llm_tutorail.md * Update docs/source/ja/_toctree.yml Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update misspelled filenames * Update docs/source/ja/_toctree.yml Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/_toctree.yml * Update docs/source/ja/_toctree.yml * missplled file names inmrpovements * Update _toctree.yml * close tip block * close another tip block * Update docs/source/ja/quicktour.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/pipeline_tutorial.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/pipeline_tutorial.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/preprocessing.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/peft.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/add_new_model.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/testing.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/task_summary.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/tasks_explained.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update glossary.md * Update docs/source/ja/transformers_agents.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/llm_tutorial.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/create_a_model.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/torchscript.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/benchmarks.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/troubleshooting.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/troubleshooting.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/troubleshooting.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/ja/add_new_model.md Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update perf_torch_compile.md * Update Year to default in en documentation * Final Update --------- Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> Co-authored-by: Younes Belkada <49240599+younesbelkada@users.noreply.github.com>
38 KiB
Custom Tools and Prompts
ãã©ã³ã¹ãã©ãŒããŒã®ã³ã³ããã¹ãã§ããŒã«ãšãšãŒãžã§ã³ããäœã§ããããç¥ããªãå Žåã ãŸãTransformers AgentsããŒãžããèªã¿ããã ãããšããå§ãããŸãã
Transformers Agentsã¯å®éšçãªAPIã§ããããã€ã§ã倿Žãããå¯èœæ§ããããŸãã ãšãŒãžã§ã³ãã«ãã£ãŠè¿ãããçµæã¯ãAPIãåºç€ãšãªãã¢ãã«ã倿Žãããå¯èœæ§ããããããå€åããããšããããŸãã
ã«ã¹ã¿ã ããŒã«ãšããã³ãããäœæãã䜿çšããããšã¯ããšãŒãžã§ã³ãã匷åããæ°ããã¿ã¹ã¯ãå®è¡ãããããã«éåžžã«éèŠã§ãã ãã®ã¬ã€ãã§ã¯ã以äžã®å 容ã説æããŸãïŒ
- ããã³ããã®ã«ã¹ã¿ãã€ãºæ¹æ³
- ã«ã¹ã¿ã ããŒã«ã®äœ¿ç𿹿³
- ã«ã¹ã¿ã ããŒã«ã®äœææ¹æ³
Customizing the prompt
Transformers Agentsã§èª¬æãããŠããããã«ããšãŒãžã§ã³ãã¯[~Agent.run
]ããã³[~Agent.chat
]ã¢ãŒãã§å®è¡ã§ããŸãã
run
ã¢ãŒããšchat
ã¢ãŒãã®äž¡æ¹ã¯åãããžãã¯ã«åºã¥ããŠããŸãã
ãšãŒãžã§ã³ããé§åããèšèªã¢ãã«ã¯ãé·ãããã³ããã«åºã¥ããŠæ¡ä»¶ä»ãããã
次ã®ããŒã¯ã³ãçæããŠåæ¢ããŒã¯ã³ã«éãããŸã§ããã³ãããå®äºããŸãã
äž¡è
ã®å¯äžã®éãã¯ãchat
ã¢ãŒãã®éã«ããã³ãããåã®ãŠãŒã¶ãŒã®å
¥åãšã¢ãã«ã®çæãšå
±ã«æ¡åŒµãããããšã§ãã
ããã«ããããšãŒãžã§ã³ãã¯éå»ã®å¯Ÿè©±ã«ã¢ã¯ã»ã¹ã§ãããšãŒãžã§ã³ãã«ããããã¡ã¢ãªããããã®ããã«èŠããŸãã
Structure of the prompt
ããã³ãããã©ã®ããã«æ§ç¯ãããã©ã®ããã«æé©åã§ããããçè§£ããããã«ãããã³ããã¯å€§ãŸãã«4ã€ã®éšåã«åãããŠããŸãã
- ã€ã³ãããã¯ã·ã§ã³ïŒãšãŒãžã§ã³ãã®æ¯ãèããããŒã«ã®æŠå¿µã®èª¬æã
- ãã¹ãŠã®ããŒã«ã®èª¬æãããã¯ãŠãŒã¶ãŒã«ãã£ãŠå®çŸ©/éžæãããããŒã«ã§ã©ã³ã¿ã€ã æã«åçã«çœ®æããã
<<all_tools>>
ããŒã¯ã³ã«ãã£ãŠå®çŸ©ãããŸãã - ã¿ã¹ã¯ãšãã®è§£æ±ºçã®äžé£ã®äŸã
- çŸåšã®äŸãšè§£æ±ºçã®èŠæ±ã
åéšåãããããçè§£ããããã«ãrun
ããã³ãããã©ã®ããã«èŠãããã®ç°¡ç¥çãèŠãŠã¿ãŸãããïŒ
ã¿ã¹ã¯ãå®è¡ããããã«ãPythonã®ã·ã³ãã«ãªã³ãã³ãã®ã·ãªãŒãºãèããŠããããšãããã§ãããã
[...]
æå³ãããå Žåã¯ãäžéçµæã衚瀺ããããšãã§ããŸãã
ããŒã«ïŒ
- document_qaïŒããã¯ããã¥ã¡ã³ãïŒpdfïŒã«é¢ãã質åã«çããããŒã«ã§ããæ
å ±ãå«ãããã¥ã¡ã³ãã§ãã `document` ãšãããã¥ã¡ã³ãã«é¢ãã質åã§ãã `question` ãåãåãã質åã«å¯Ÿããåçãå«ãããã¹ããè¿ããŸãã
- image_captionerïŒããã¯ç»åã®èª¬æãçæããããŒã«ã§ãããã£ãã·ã§ã³ã«ããç»åã§ãã `image` ãšã説æãå«ãè±èªã®ããã¹ããè¿ãããã¹ããåãåããŸãã
[...]
ã¿ã¹ã¯: "倿° `question` ã«é¢ãã質åã«çããããã®ç»åã«ã€ããŠåçããŠãã ããã質åã¯ãã©ã³ã¹èªã§ãã"
次ã®ããŒã«ã䜿çšããŸãïŒè³ªåãè±èªã«ç¿»èš³ããããã® `translator`ããããŠå
¥åç»åã«é¢ãã質åã«çããããã® `image_qa`ã
åçïŒ
```py
translated_question = translator(question=question, src_lang="French", tgt_lang="English")
print(f"The translated question is {translated_question}.")
answer = image_qa(image=image, question=translated_question)
print(f"The answer is {answer}")
```
ã¿ã¹ã¯ïŒã`document`å
ã§æå¹Žé·ã®äººç©ãç¹å®ãããã®çµæããããŒãšããŠè¡šç€ºãããã
以äžã®ããŒã«ã䜿çšããŸãïŒ`document_qa`ã䜿çšããŠããã¥ã¡ã³ãå
ã§æå¹Žé·ã®äººç©ãèŠã€ãããã®åçã«åŸã£ãŠ`image_generator`ã䜿çšããŠç»åãçæããŸãã
åçïŒ
```py
answer = document_qa(document, question="What is the oldest person?")
print(f"The answer is {answer}.")
image = image_generator("A banner showing " + answer)
```
[...]
ã¿ã¹ã¯: "å·ãšæ¹ã®çµµãæããŠãã ãã"
以äžã®ãã®ã䜿çšããŸã
å°å ¥éšåïŒ"Tools:"ã®åã®ããã¹ãïŒã¯ãã¢ãã«ã®æ¯ãèããšå®è¡ãã¹ãã¿ã¹ã¯ãæ£ç¢ºã«èª¬æããŠããŸãã ãã®éšåã¯ãããããšãŒãžã§ã³ããåžžã«åãæ¹æ³ã§æ¯ãèãå¿ èŠããããããã«ã¹ã¿ãã€ãºããå¿ èŠã¯ãããŸããã
2çªç®ã®éšåïŒ"Tools"ã®äžã®ç®æ¡æžãïŒã¯ãrun
ãŸãã¯chat
ãåŒã³åºããã³ã«åçã«è¿œå ãããŸãã
agent.toolbox
å
ã®ããŒã«ã®æ°ãšåãæ°ã®ç®æ¡æžãããããããããã®ç®æ¡æžãã«ã¯ããŒã«ã®ååãšèª¬æãå«ãŸããŠããŸãã
- <tool.name>: <tool.description>
ãããã確èªããŸãããã document_qa
ããŒã«ãèªã¿èŸŒãã§ååãšèª¬æãåºåããŸãã
from transformers import load_tool
document_qa = load_tool("document-question-answering")
print(f"- {document_qa.name}: {document_qa.description}")
which gives:
- document_qa: This is a tool that answers a question about a document (pdf). It takes an input named `document` which should be the document containing the information, as well as a `question` that is the question about the document. It returns a text that contains the answer to the question.
ããŒã«èª¬æ: ãã®ããŒã«ã¯ã2ã€ã®ããŒãããæãç«ã£ãŠããŸããæåã®ããŒãã§ã¯ãããŒã«ãäœãè¡ããã説æãã2çªç®ã®ããŒãã§ã¯å ¥ååŒæ°ãšæ»ãå€ãã©ã®ããã«æåŸ ãããããè¿°ã¹ãŠããŸãã
è¯ãããŒã«åãšããŒã«ã®èª¬æã¯ããšãŒãžã§ã³ããæ£ãã䜿çšããããã«éåžžã«éèŠã§ãããšãŒãžã§ã³ããããŒã«ã«ã€ããŠæã£ãŠããå¯äžã®æ å ±ã¯ããã®ååãšèª¬æã§ãããããã£ãŠãããŒã«åãšèª¬æã®äž¡æ¹ãæ£ç¢ºã«èšè¿°ãããããŒã«ããã¯ã¹å ã®æ¢åã®ããŒã«ã®ã¹ã¿ã€ã«ã«åèŽããããšã確èªããå¿ èŠããããŸããç¹ã«ã説æã«ã¯ã³ãŒãã¹ã¿ã€ã«ã§ååã§æåŸ ããããã¹ãŠã®åŒæ°ãèšåãããæåŸ ãããåãšããããäœã§ãããã®èª¬æãå«ããã¹ãã§ãã
ãã¥ã¬ãŒããããTransformersããŒã«ã®åœåãšèª¬æã確èªããŠãããŒã«ãã©ã®ãããªååãšèª¬æãæã€ã¹ãããçè§£ããã®ã«åœ¹ç«ã¡ãŸãã
ãã¹ãŠã®ããŒã«ã¯[Agent.toolbox
]ããããã£ã§ç¢ºèªã§ããŸãã
ã«ã¹ã¿ãã€ãºãããäŸïŒ ããŒã«ã®äœ¿ãæ¹ããšãŒãžã§ã³ãã«æ£ç¢ºã«ç€ºãäžé£ã®äŸãå«ãŸããŠããŸãããããã®äŸã¯ããšãŒãžã§ã³ããå®éã«æ£ç¢ºã§å®è¡å¯èœãªã³ãŒããçæããå¯èœæ§ãæå€§åããããã«æžãããŠãããããéåžžã«éèŠã§ããå€§èŠæš¡ãªèšèªã¢ãã«ã¯ãããã³ããå ã®ãã¿ãŒã³ãèªèããæ°ããããŒã¿ã䜿çšããŠãã®ãã¿ãŒã³ãç¹°ãè¿ãããšã«éåžžã«åªããŠããŸãããããã£ãŠãå®è·µã§æ£ããå®è¡å¯èœãªã³ãŒããçæãããšãŒãžã§ã³ãã®å¯èœæ§ãæå€§åããããã«ããããã®äŸã¯æžãããŠããå¿ èŠããããŸãã
以äžã¯ãäžã€ã®äŸã§ãïŒ
Task: "Identify the oldest person in the `document` and create an image showcasing the result as a banner."
I will use the following tools: `document_qa` to find the oldest person in the document, then `image_generator` to generate an image according to the answer.
Answer:
```py
answer = document_qa(document, question="What is the oldest person?")
print(f"The answer is {answer}.")
image = image_generator("A banner showing " + answer)
```
ãã¿ãŒã³ïŒã¢ãã«ãç¹°ãè¿ããè¡ãããã«æç€ºããããã¿ãŒã³ã«ã¯ã3ã€ã®éšåããããŸãã ã¿ã¹ã¯ã®å£°æããšãŒãžã§ã³ãã®æå³ããåäœã®èª¬æããããŠæåŸã«çæãããã³ãŒãã§ãã ããã³ããã®äžéšã§ãããã¹ãŠã®äŸã«ã¯ããã®æ£ç¢ºãªãã¿ãŒã³ãããããšãŒãžã§ã³ããæ°ããããŒã¯ã³ãçæããéã«ã åããã¿ãŒã³ãåçŸããããšã確èªããŠããŸãã
ããã³ããã®äŸã¯TransformersããŒã ã«ãã£ãŠå³éžãããäžé£ã®åé¡ã¹ããŒãã¡ã³ãã§å³å¯ã«è©äŸ¡ãããŸãã ããã«ããããšãŒãžã§ã³ãã®ããã³ããããšãŒãžã§ã³ãã®å®éã®äœ¿çšã±ãŒã¹ã解決ããããã«ã§ããã ãåªãããã®ã«ãªããŸãã
ããã³ããã®æåŸã®éšåã«å¯Ÿå¿ããŠããŸãïŒ
ãã¡ãã®åé¡ã¹ããŒãã¡ã³ãã§å³å¯ã«è©äŸ¡ãããããšãŒãžã§ã³ãã®ããã³ãããã§ããã ãåªãããã®ã«ãªãããã« æ éã«éžå®ãããããã³ããäŸãæäŸããŠããŸãã
Task: "Draw me a picture of rivers and lakes"
I will use the following
ããããšãŒãžã§ã³ãã«å®æãããããã®æçµçã§æªå®æã®äŸã§ããæªå®æã®äŸã¯ãå®éã®ãŠãŒã¶ãŒå ¥åã«åºã¥ããŠåçã«äœæãããŸããäžèšã®äŸã§ã¯ããŠãŒã¶ãŒã次ã®ããã«å®è¡ããŸããïŒ
agent.run("Draw me a picture of rivers and lakes")
ãŠãŒã¶ãŒã®å ¥å - ã€ãŸããã¿ã¹ã¯ïŒ"å·ãšæ¹ã®çµµãæããŠãã ãã"ã¯ã以äžã®ãããªããã³ãããã³ãã¬ãŒãã«å€æãããŸãïŒ"ã¿ã¹ã¯ïŒ \n\n 次ã«ç§ã¯ä»¥äžã䜿çšããŸã"ã ãã®æã¯ããšãŒãžã§ã³ããæ¡ä»¶ä»ããããããã³ããã®æçµè¡ãæ§æãããããã£ãŠãšãŒãžã§ã³ãã«å¯ŸããŠåã®äŸãšãŸã£ããåãæ¹æ³ã§äŸãçµäºãããã匷ã圱é¿ããŸãã
詳现ã«ã¯ç«ã¡å ¥ããŸãããããã£ãããã³ãã¬ãŒãã¯åãããã³ããæ§é ãæã¡ãäŸã¯ãããã«ç°ãªãã¹ã¿ã€ã«ãæã£ãŠããŸããäŸïŒ
[...]
=====
Human: Answer the question in the variable `question` about the image stored in the variable `image`.
Assistant: I will use the tool `image_qa` to answer the question on the input image.
```py
answer = image_qa(text=question, image=image)
print(f"The answer is {answer}")
```
Human: I tried this code, it worked but didn't give me a good result. The question is in French
Assistant: In this case, the question needs to be translated first. I will use the tool `translator` to do this.
```py
translated_question = translator(question=question, src_lang="French", tgt_lang="English")
print(f"The translated question is {translated_question}.")
answer = image_qa(text=translated_question, image=image)
print(f"The answer is {answer}")
```
=====
[...]
Human: run
ããã³ããã®äŸãšã¯å¯Ÿç
§çã«ãåchat
ããã³ããã®äŸã«ã¯HumanãšAssistantã®éã§1ã€ä»¥äžã®ãããšãããããŸããåãããšãã¯ãrun
ããã³ããã®äŸãšåæ§ã®æ§é ã«ãªã£ãŠããŸãããŠãŒã¶ãŒã®å
¥åã¯*Human:*ã®åŸãã«è¿œå ããããšãŒãžã§ã³ãã«ã¯ã³ãŒããçæããåã«äœãè¡ãå¿
èŠãããããæåã«çæããããã«æç€ºãããŸãããããšãã¯ä»¥åã®ãããšãã«åºã¥ããŠè¡ãããããšãããããŠãŒã¶ãŒããI tried this codeããšå
¥åããããã«ã以åã«çæããããšãŒãžã§ã³ãã®ã³ãŒããåç
§ã§ããŸãã
Assistant: .chat
ãå®è¡ãããšããŠãŒã¶ãŒã®å
¥åãŸãã¯ã¿ã¹ã¯ãæªå®äºã®åœ¢åŒã«å€æãããŸãïŒ
Human: <user-input>\n\nAssistant:
以äžã®ãšãŒãžã§ã³ããå®äºããã³ãã³ãã«ã€ããŠèª¬æããŸãã run
ã³ãã³ããšã¯å¯Ÿç
§çã«ãchat
ã³ãã³ãã¯å®äºããäŸãããã³ããã«è¿œå ããŸãããã®ãããæ¬¡ã® chat
ã¿ãŒã³ã®ããã«ãšãŒãžã§ã³ãã«ããå€ãã®æèãæäŸããŸãã
ããŠãããã³ããã®æ§é ãããã£ããšããã§ãã©ã®ããã«ã«ã¹ã¿ãã€ãºã§ããããèŠãŠã¿ãŸãããïŒ
Writing good user inputs
å€§èŠæš¡ãªèšèªã¢ãã«ã¯ãŠãŒã¶ãŒã®æå³ãçè§£ããèœåããŸããŸãåäžããŠããŸããããšãŒãžã§ã³ããæ£ããã¿ã¹ã¯ãéžæããã®ãå©ããããã«ãã§ããã ãæ£ç¢ºã«èšè¿°ããããšãéåžžã«åœ¹ç«ã¡ãŸããã§ããã ãæ£ç¢ºã§ãããšã¯äœãæå³ããã®ã§ããããïŒ
ãšãŒãžã§ã³ãã¯ãããã³ããã§ããŒã«åãšãã®èª¬æã®ãªã¹ããèŠãŠããŸããããŒã«ã远å ãããã»ã©ããšãŒãžã§ã³ããæ£ããããŒã«ãéžæããã®ãé£ãããªããæ£ããããŒã«ã®é£ç¶ãéžæããã®ã¯ããã«é£ãããªããŸããå ±éã®å€±æäŸãèŠãŠã¿ãŸããããããã§ã¯ã³ãŒãã®ã¿ãè¿ãããšã«ããŸãã
from transformers import HfAgent
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
agent.run("Show me a tree", return_code=True)
gives:
==Explanation from the agent==
I will use the following tool: `image_segmenter` to create a segmentation mask for the image.
==Code generated by the agent==
mask = image_segmenter(image, prompt="tree")
ããã¯ããããç§ãã¡ãæãã§ãããã®ã§ã¯ãªãã§ãããã代ããã«ãæšã®ç»åãçæãããããšãããå¯èœæ§ãé«ãã§ãã ç¹å®ã®ããŒã«ã䜿çšãããããšãŒãžã§ã³ããèªå°ããããã«ãããŒã«ã®ååã説æã«å«ãŸããŠããéèŠãªããŒã¯ãŒãã䜿çšããããšã¯éåžžã«åœ¹ç«ã¡ãŸããããŠã詳ããèŠãŠã¿ãŸãããã
agent.toolbox["image_generator"].description
'This is a tool that creates an image according to a prompt, which is a text description. It takes an input named `prompt` which contains the image description and outputs an image.
ååãšèª¬ææã«ã¯ãããŒã¯ãŒããç»åãããããã³ãããããäœæããããã³ãçæãã䜿çšãããŠããŸãããããã®èšèã䜿çšããããšã§ãããã§ã®åäœããã广çã«ãªãå¯èœæ§ãé«ãã§ããããã³ãããå°ã詳现ã«èª¿æŽããŸãããã
agent.run("Create an image of a tree", return_code=True)
gives:
==Explanation from the agent==
I will use the following tool `image_generator` to generate an image of a tree.
==Code generated by the agent==
image = image_generator(prompt="tree")
ç°¡åã«èšããšããšãŒãžã§ã³ããã¿ã¹ã¯ãæ£ç¢ºã«é©åãªããŒã«ã«ãããã³ã°ã§ããªãå Žåã¯ãããŒã«ã®ååã説æã®æãé¢é£æ§ã®ããããŒã¯ãŒãã調ã¹ãŠãã¿ã¹ã¯ãªã¯ãšã¹ããããã«åãããŠæŽç·ŽãããŠã¿ãŠãã ããã
Customizing the tool descriptions
以åã«ãèŠãããã«ããšãŒãžã§ã³ãã¯åããŒã«ã®ååãšèª¬æã«ã¢ã¯ã»ã¹ã§ããŸããããŒã¹ã®ããŒã«ã¯éåžžã«æ£ç¢ºãªååãšèª¬æãæã£ãŠããã¯ãã§ãããç¹å®ã®ãŠãŒã¹ã±ãŒã¹ã«åãããŠããŒã«ã®èª¬æãååã倿Žããããšã圹ç«ã€ãããããŸãããããã¯ãéåžžã«é¡äŒŒããè€æ°ã®ããŒã«ã远å ããå Žåããç¹å®ã®ãã¡ã€ã³ïŒããšãã°ãç»åçæã倿ãªã©ïŒã§ãšãŒãžã§ã³ãã䜿çšããå Žåã«ç¹ã«éèŠã«ãªããããããŸããã
ããããåé¡ã¯ããšãŒãžã§ã³ããç»åçæã¿ã¹ã¯ã«é »ç¹ã«äœ¿çšãããå Žåãç»åçæãšç»å倿/ä¿®æ£ãæ··åããããšã§ãã
äŸïŒ
agent.run("Make an image of a house and a car", return_code=True)
returns
==Explanation from the agent==
I will use the following tools `image_generator` to generate an image of a house and `image_transformer` to transform the image of a car into the image of a house.
==Code generated by the agent==
house_image = image_generator(prompt="A house")
car_image = image_generator(prompt="A car")
house_car_image = image_transformer(image=car_image, prompt="A house")
ããã¯ããããç§ãã¡ãããã§æãã§ããæ£ç¢ºãªãã®ã§ã¯ãªãããã§ãããšãŒãžã§ã³ãã¯ãimage_generatorããšãimage_transformerãã®éããçè§£ããã®ãé£ããããã§ããã°ãã°äž¡æ¹ãäžç·ã«äœ¿çšããŸãã
ããã§ãšãŒãžã§ã³ãããµããŒãããããã«ã"image_transformer"ã®ããŒã«åãšèª¬æã倿ŽããŠãå°ã"image"ã"prompt"ããåãé¢ããŠã¿ãŸãããã代ããã«ããããmodifierããšåŒã³ãŸãããïŒ
agent.toolbox["modifier"] = agent.toolbox.pop("image_transformer")
agent.toolbox["modifier"].description = agent.toolbox["modifier"].description.replace(
"transforms an image according to a prompt", "modifies an image"
)
ã倿Žãã¯ãäžèšã®ããã³ããã«æ°ããç»åããã»ããµã䜿çšãã匷åãªæãããã§ããããã§ã¯ãããäžåºŠå®è¡ããŠã¿ãŸãããã
agent.run("Make an image of a house and a car", return_code=True)
Now we're getting:
==Explanation from the agent==
I will use the following tools: `image_generator` to generate an image of a house, then `image_generator` to generate an image of a car.
==Code generated by the agent==
house_image = image_generator(prompt="A house")
car_image = image_generator(prompt="A car")
ããã¯ãç§ãã¡ãèããŠãããã®ã«ç¢ºå®ã«è¿ã¥ããŠããŸãïŒãã ããå®¶ãšè»ãåãç»åã«å«ããããšèããŠããŸããã¿ã¹ã¯ãåäžã®ç»åçæã«åããããšã§ãããé©åãªæ¹åã«é²ããã¯ãã§ãïŒ
agent.run("Create image: 'A house and car'", return_code=True)
==Explanation from the agent==
I will use the following tool: `image_generator` to generate an image.
==Code generated by the agent==
image = image_generator(prompt="A house and car")
ãšãŒãžã§ã³ãã¯ãç¹ã«è€æ°ã®ãªããžã§ã¯ãã®ç»åãçæãããªã©ãããè€éãªãŠãŒã¹ã±ãŒã¹ã«é¢ããŠã¯ããŸã å€ãã®ãŠãŒã¹ã±ãŒã¹ã«å¯ŸããŠè匱ã§ãã ãšãŒãžã§ã³ãèªäœãšãã®åºç€ãšãªãããã³ããã¯ãä»åŸæ°ã¶æã§ããã«æ¹åãããããŸããŸãªãŠãŒã¶ãŒã®å ¥åã«å¯ŸããŠãšãŒãžã§ã³ããããé å¥ã«ãªãããã«ãªããŸãã
Customizing the whole project
ãŠãŒã¶ãŒã«æå€§éã®æè»æ§ãæäŸããããã«ãäžèšã§èª¬æãããããã³ãããã³ãã¬ãŒãå
šäœããŠãŒã¶ãŒãäžæžãã§ããŸãããã®å Žåãã«ã¹ã¿ã ããã³ããã«ã¯å°å
¥ã»ã¯ã·ã§ã³ãããŒã«ã»ã¯ã·ã§ã³ãäŸã»ã¯ã·ã§ã³ãæªå®äºã®äŸã»ã¯ã·ã§ã³ãå«ãŸããŠããããšã確èªããŠãã ãããrun
ããã³ãããã³ãã¬ãŒããäžæžããããå Žåã以äžã®ããã«è¡ãããšãã§ããŸã:
template = """ [...] """
agent = HfAgent(your_endpoint, run_prompt_template=template)
<<all_tools>>
æååãš <<prompt>>
ã¯ããšãŒãžã§ã³ãã䜿çšã§ããããŒã«ãèªèãããŠãŒã¶ãŒã®ããã³ãããæ£ããæ¿å
¥ã§ããããã«ãtemplate
ã®ã©ããã«å®çŸ©ãããŠããããšã確èªããŠãã ããã
åæ§ã«ãchat
ããã³ãããã³ãã¬ãŒããäžæžãããããšãã§ããŸãããªããchat
ã¢ãŒãã§ã¯åžžã«ä»¥äžã®åœ¢åŒã§äº€æãè¡ãããŸãïŒ
äžèšã®ããã¹ãã®äžã«æ¥æ¬èªã®ç¿»èš³ãæäŸããŠãã ãããMarkdownã³ãŒããšããŠæžããŠãã ããã
Human: <<task>>
Assistant:
ãããã£ãŠãã«ã¹ã¿ã chat
ããã³ãããã³ãã¬ãŒãã®äŸããã®ãã©ãŒãããã䜿çšããããšãéèŠã§ãã以äžã®ããã«ãã€ã³ã¹ã¿ã³ã¹åæã«chat
ãã³ãã¬ãŒããäžæžãã§ããŸãã
template = """ [...] """
agent = HfAgent(url_endpoint=your_endpoint, chat_prompt_template=template)
<<all_tools>>
ãšããæååã template
å
ã§å®çŸ©ãããŠããããšã確èªããŠãã ãããããã«ããããšãŒãžã§ã³ãã¯äœ¿çšå¯èœãªããŒã«ãææ¡ã§ããŸãã
äž¡æ¹ã®å Žåãããã³ãããã³ãã¬ãŒãã®ä»£ããã«ãã³ãã¥ããã£ã®èª°ãããã¹ããããã³ãã¬ãŒãã䜿çšãããå Žåã¯ããªããžããªIDãæž¡ãããšãã§ããŸããããã©ã«ãã®ããã³ããã¯ããã®ãªããžã㪠ã«ãããŸãã®ã§ãåèã«ãªããŸãã
ã«ã¹ã¿ã ããã³ãããHubã®ãªããžããªã«ã¢ããããŒãããŠã³ãã¥ããã£ãšå ±æããå Žåã¯ã次ã®ããšã確èªããŠãã ããïŒ
- ããŒã¿ã»ãããªããžããªã䜿çšããããš
run
ã³ãã³ãçšã®ããã³ãããã³ãã¬ãŒããrun_prompt_template.txt
ãšããååã®ãã¡ã€ã«ã«é 眮ããããšchat
ã³ãã³ãçšã®ããã³ãããã³ãã¬ãŒããchat_prompt_template.txt
ãšããååã®ãã¡ã€ã«ã«é 眮ããããš
Using custom tools
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãç»åçæã«ç¹åãã2ã€ã®æ¢åã®ã«ã¹ã¿ã ããŒã«ãå©çšããŸãïŒ
- huggingface-tools/image-transformation ãããå€ãã®ç»å倿Žãå¯èœã«ããããã« diffusers/controlnet-canny-tool ã«çœ®ãæããŸãã
- ç»åã®ã¢ããã¹ã±ãŒãªã³ã°çšã®æ°ããããŒã«ãããã©ã«ãã®ããŒã«ããã¯ã¹ã«è¿œå ããŸãïŒdiffusers/latent-upscaler-tool ã¯æ¢åã®ç»å倿ããŒã«ã眮ãæããŸãã
䟿å©ãª [load_tool
] 颿°ã䜿çšããŠã«ã¹ã¿ã ããŒã«ãããŒãããŸãïŒ
from transformers import load_tool
controlnet_transformer = load_tool("diffusers/controlnet-canny-tool")
upscaler = load_tool("diffusers/latent-upscaler-tool")
ãšãŒãžã§ã³ãã«ã«ã¹ã¿ã ããŒã«ã远å ãããšãããŒã«ã®èª¬æãšååããšãŒãžã§ã³ãã®ããã³ããã«èªåçã«å«ãŸããŸãããããã£ãŠããšãŒãžã§ã³ããã«ã¹ã¿ã ããŒã«ã®äœ¿ç𿹿³ãçè§£ã§ããããã«ãã«ã¹ã¿ã ããŒã«ã«ã¯é©åã«èšè¿°ããã説æãšååãå¿ èŠã§ãã
controlnet_transformer
ã®èª¬æãšååãèŠãŠã¿ãŸãããã
æåã«ã䟿å©ãª[load_tool
]颿°ã䜿çšããŠã«ã¹ã¿ã ããŒã«ãããŒãããŸãã
print(f"Description: '{controlnet_transformer.description}'")
print(f"Name: '{controlnet_transformer.name}'")
gives
Description: 'This is a tool that transforms an image with ControlNet according to a prompt.
It takes two inputs: `image`, which should be the image to transform, and `prompt`, which should be the prompt to use to change it. It returns the modified image.'
Name: 'image_transformer'
ååãšèª¬æã¯æ£ç¢ºã§ãããå³éžãããããŒã«ã®ã¹ã¿ã€ã«ã«åã£ãŠããŸãã
次ã«ãcontrolnet_transformer
ãšupscaler
ã䜿ã£ãŠãšãŒãžã§ã³ããã€ã³ã¹ã¿ã³ã¹åããŸãã
tools = [controlnet_transformer, upscaler]
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=tools)
以äžã®ã³ãã³ãã¯ã以äžã®æ å ±ãæäŸããŸãïŒ
image_transformer has been replaced by <transformers_modules.diffusers.controlnet-canny-tool.bd76182c7777eba9612fc03c0
8718a60c0aa6312.image_transformation.ControlNetTransformationTool object at 0x7f1d3bfa3a00> as provided in `additional_tools`
äžé£ã®å³éžãããããŒã«ã«ã¯ãã§ã« image_transformer
ããŒã«ãããããããã«ã¹ã¿ã ããŒã«ã§çœ®ãæããŸãã
æ¢åã®ããŒã«ãäžæžãããããšã¯ãç¹å®ã®ã¿ã¹ã¯ã«æ¢åã®ããŒã«ããŸã£ããåãç®çã§äœ¿çšãããå Žåã«æçã§ããããšããããŸãã ãªããªãããšãŒãžã§ã³ãã¯ãã®ç¹å®ã®ã¿ã¹ã¯ã®äœ¿ç𿹿³ã«ç²ŸéããŠããããã§ãããã®å Žåãã«ã¹ã¿ã ããŒã«ã¯æ¢åã®ããŒã«ãšãŸã£ããåãAPIã«åŸããããã®ããŒã«ã䜿çšãããã¹ãŠã®äŸãæŽæ°ãããããã«ããã³ãããã³ãã¬ãŒããé©å¿ãããå¿ èŠããããŸãã
ã¢ããã¹ã±ãŒã©ãŒããŒã«ã«ã¯ image_upscaler
ãšããååãä»ããããããã¯ããã©ã«ãã®ããŒã«ããã¯ã¹ã«ã¯ãŸã ååšããªããããåã«ããŒã«ã®ãªã¹ãã«è¿œå ãããŸãã
ãšãŒãžã§ã³ããçŸåšäœ¿çšå¯èœãªããŒã«ããã¯ã¹ã確èªããã«ã¯ãagent.toolbox
屿§ã䜿çšã§ããŸãã
print("\n".join([f"- {a}" for a in agent.toolbox.keys()]))
- document_qa
- image_captioner
- image_qa
- image_segmenter
- transcriber
- summarizer
- text_classifier
- text_qa
- text_reader
- translator
- image_transformer
- text_downloader
- image_generator
- video_generator
- image_upscaler
泚æ: image_upscaler
ããšãŒãžã§ã³ãã®ããŒã«ããã¯ã¹ã®äžéšãšãªã£ãããšã«æ³šç®ããŠãã ããã
ããã§ã¯ãæ°ããããŒã«ã詊ããŠã¿ãŸãããïŒTransformers Agents Quickstart ã§çæããç»åãåå©çšããŸãã
from diffusers.utils import load_image
image = load_image(
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rivers_and_lakes.png"
)

çŸããå¬ã®é¢šæ¯ã«ãã®ç»åãå€èº«ãããŸãããïŒ
image = agent.run("Transform the image: 'A frozen lake and snowy forest'", image=image)
==Explanation from the agent==
I will use the following tool: `image_transformer` to transform the image.
==Code generated by the agent==
image = image_transformer(image, prompt="A frozen lake and snowy forest")

æ°ããç»ååŠçããŒã«ã¯ãéåžžã«åŒ·åãªç»åã®å€æŽãè¡ãããšãã§ããControlNetã«åºã¥ããŠããŸãã ããã©ã«ãã§ã¯ãç»ååŠçããŒã«ã¯ãµã€ãºã512x512ãã¯ã»ã«ã®ç»åãè¿ããŸãããããæ¡å€§ã§ãããèŠãŠã¿ãŸãããã
image = agent.run("Upscale the image", image)
==Explanation from the agent==
I will use the following tool: `image_upscaler` to upscale the image.
==Code generated by the agent==
upscaled_image = image_upscaler(image)

ãšãŒãžã§ã³ãã¯ãããã³ãããç»åã®æ¡å€§ããããã®èª¬æãšããŒã«ã®ååã ããåºã«ãæ°ãã«è¿œå ãããã¢ããã¹ã±ãŒãªã³ã°ããŒã«ã«èªåçã«ãããã³ã°ããæ£ããå®è¡ã§ããŸããã
次ã«ãæ°ããã«ã¹ã¿ã ããŒã«ãäœæããæ¹æ³ãèŠãŠã¿ãŸãããã
Adding new tools
ãã®ã»ã¯ã·ã§ã³ã§ã¯ããšãŒãžã§ã³ãã«è¿œå ã§ããæ°ããããŒã«ã®äœææ¹æ³ã瀺ããŸãã
Creating a new tool
ãŸããããŒã«ã®äœæããå§ããŸããããæ¬¡ã®ã³ãŒãã§ãç¹å®ã®ã¿ã¹ã¯ã«é¢ããŠHugging Face Hubã§æãããŠã³ããŒããããã¢ãã«ãååŸãããããŸã圹ç«ããªãããã©ã楜ããã¿ã¹ã¯ã远å ããŸãã
以äžã®ã³ãŒãã§ãããè¡ãããšãã§ããŸãïŒ
from huggingface_hub import list_models
task = "text-classification"
model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
print(model.id)
ã¿ã¹ã¯ text-classification
ã®å Žåããã㯠'facebook/bart-large-mnli'
ãè¿ããŸããtranslation
ã®å Žåã't5-base'
ãè¿ããŸãã
ããããšãŒãžã§ã³ããå©çšã§ããããŒã«ã«å€æããæ¹æ³ã¯äœã§ããããïŒãã¹ãŠã®ããŒã«ã¯ãäž»èŠãªå±æ§ãä¿æããã¹ãŒããŒã¯ã©ã¹ Tool
ã«äŸåããŠããŸããç§ãã¡ã¯ããããç¶æ¿ããã¯ã©ã¹ãäœæããŸã:
from transformers import Tool
class HFModelDownloadsTool(Tool):
pass
ãã®ã¯ã©ã¹ã«ã¯ããã€ãã®å¿ èŠãªèŠçŽ ããããŸãïŒ
name
屿§ïŒããã¯ããŒã«èªäœã®ååã«å¯Ÿå¿ããä»ã®ããŒã«ãšèª¿åããããã«model_download_counter
ãšåä»ããŸããdescription
屿§ïŒããã¯ãšãŒãžã§ã³ãã®ããã³ãããåããããã«äœ¿çšãããŸããinputs
ãšoutputs
屿§ïŒããããå®çŸ©ããããšã§ãPython ã€ã³ã¿ãŒããªã¿ãŒãåã«é¢ããè³¢æãªéžæãè¡ãã®ã«åœ¹ç«ã¡ãããŒã«ãHubã«ããã·ã¥ããéã«gradio-demoãçæã§ããããã«ãªããŸãããããã¯ãäºæ³ãããå€ã®ãªã¹ãã§ãããtext
ãimage
ããŸãã¯audio
ã«ãªãããšããããŸãã__call__
ã¡ãœããïŒããã«ã¯æšè«ã³ãŒããå«ãŸããŠããŸããããã¯äžèšã§è©Šããã³ãŒãã§ãïŒ
ãã¡ããçŸåšã®ã¯ã©ã¹ã®å€èгã§ãïŒ
from transformers import Tool
from huggingface_hub import list_models
class HFModelDownloadsTool(Tool):
name = "model_download_counter"
description = (
"This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. "
"It takes the name of the category (such as text-classification, depth-estimation, etc), and "
"returns the name of the checkpoint."
)
inputs = ["text"]
outputs = ["text"]
def __call__(self, task: str):
model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
return model.id
ããŠãä»åºŠã¯ããŒã«ã䜿ããããã«ãªããŸããããã®ããŒã«ããã¡ã€ã«ã«ä¿åããã¡ã€ã³ã¹ã¯ãªããããã€ã³ããŒãããŸãããããã®ãã¡ã€ã«ã model_downloads.py
ãšããååã«ããçµæã®ã€ã³ããŒãã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãïŒ
以äžã¯ãçŸåšã®ã¯ã©ã¹ã®å€èгã§ãïŒ
from model_downloads import HFModelDownloadsTool
tool = HFModelDownloadsTool()
ä»ã®äººã
ã«å©çããããããããç°¡åãªåæåã®ããã«ããããHubã«ããªãã®åå空éã§ããã·ã¥ããããšããå§ãããŸãããããè¡ãã«ã¯ãtool
倿°ã§ push_to_hub
ãåŒã³åºãã ãã§ãïŒ
tool.push_to_hub("hf-model-downloads")
ãšãŒãžã§ã³ããããŒã«ã䜿çšããæ¹æ³ã«ã€ããŠãæçµã¹ããããèŠãŠã¿ãŸãããã
Having the agent use the tool
Hubã«ããããŒã«ããããŸããããã¯æ¬¡ã®ããã«ã€ã³ã¹ã¿ã³ã¹åã§ããŸãïŒãŠãŒã¶ãŒåãããŒã«ã«åãããŠå€æŽããŠãã ããïŒ:
from transformers import load_tool
tool = load_tool("lysandre/hf-model-downloads")
ãšãŒãžã§ã³ãã§äœ¿çšããããã«ã¯ããšãŒãžã§ã³ãã®åæåã¡ãœããã® additional_tools
ãã©ã¡ãŒã¿ã«ãããæž¡ãã ãã§ãïŒ
from transformers import HfAgent
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[tool])
agent.run(
"Can you read out loud the name of the model that has the most downloads in the 'text-to-video' task on the Hugging Face Hub?"
)
which outputs the following:
==Code generated by the agent==
model = model_download_counter(task="text-to-video")
print(f"The model with the most downloads is {model}.")
audio_model = text_reader(model)
==Result==
The model with the most downloads is damo-vilab/text-to-video-ms-1.7b.
以äžã®ããã¹ãã¯ã次ã®ãªãŒãã£ãªãçæããŸãã
Audio |
---|
ç¹å®ã®LLMã«äŸåããããšããããããŸãæ©èœãããããã«ã¯éåžžã«æ£ç¢ºãªããã³ãããå¿ èŠãªãã®ããããŸããããŒã«ã®ååãšèª¬æãæç¢ºã«å®çŸ©ããããšã¯ããšãŒãžã§ã³ãã«ãã£ãп޻çšãããããã«éåžžã«éèŠã§ãã
Replacing existing tools
æ¢åã®ããŒã«ã眮ãæããã«ã¯ãæ°ããã¢ã€ãã ããšãŒãžã§ã³ãã®ããŒã«ããã¯ã¹ã«å²ãåœãŠãã ãã§è¡ãããšãã§ããŸãã以äžã¯ãã®æ¹æ³ã§ã:
from transformers import HfAgent, load_tool
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
agent.toolbox["image-transformation"] = load_tool("diffusers/controlnet-canny-tool")
ä»ã®ããŒã«ã§ããŒã«ã眮ãæããéã«ã¯æ³šæãå¿ èŠã§ãïŒããã«ããããšãŒãžã§ã³ãã®ããã³ããã調æŽãããŸããããã¯ãã¿ã¹ã¯ã«é©ããããè¯ãããã³ãããæã£ãŠããå Žåã«ã¯è¯ãããšã§ãããä»ã®ããŒã«ãéžæããã確çãé«ããªããå®çŸ©ããããŒã«ã®ä»£ããã«ä»ã®ããŒã«ãéžæãããããšããããããããŸããã
Leveraging gradio-tools
gradio-toolsã¯ãHugging Face SpacesãããŒã«ãšããŠäœ¿çšããããšãå¯èœã«ãã匷åãªã©ã€ãã©ãªã§ããæ¢åã®å€ãã®Spacesããã³ã«ã¹ã¿ã SpacesãèšèšããããšããµããŒãããŠããŸãã
æã
ã¯ãgradio_tools
ã䜿çšããŠStableDiffusionPromptGeneratorTool
ããŒã«ã掻çšããããšèããŠããŸãããã®ããŒã«ã¯gradio-tools
ããŒã«ãããã§æäŸãããŠãããããã³ãããæ¹åããããè¯ãç»åãçæããããã«äœ¿çšããŸãã
ãŸããgradio_tools
ããããŒã«ãã€ã³ããŒããããããã€ã³ã¹ã¿ã³ã¹åããŸã:
from gradio_tools import StableDiffusionPromptGeneratorTool
gradio_tool = StableDiffusionPromptGeneratorTool()
ãã®ã€ã³ã¹ã¿ã³ã¹ã Tool.from_gradio
ã¡ãœããã«æž¡ããŸãïŒ
from transformers import Tool
tool = Tool.from_gradio(gradio_tool)
ããããã¯ãéåžžã®ã«ã¹ã¿ã ããŒã«ãšåãããã«ããã管çã§ããŸããç§ãã¡ã¯ããã³ãããæ¹åããããã«ãããæŽ»çšããŸãã
a rabbit wearing a space suit
:
from transformers import HfAgent
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[tool])
agent.run("Generate an image of the `prompt` after improving it.", prompt="A rabbit wearing a space suit")
The model adequately leverages the tool:
==Explanation from the agent==
I will use the following tools: `StableDiffusionPromptGenerator` to improve the prompt, then `image_generator` to generate an image according to the improved prompt.
==Code generated by the agent==
improved_prompt = StableDiffusionPromptGenerator(prompt)
print(f"The improved prompt is {improved_prompt}.")
image = image_generator(improved_prompt)
æçµçã«ç»åãçæããåã«ïŒ

gradio-toolsã¯ãããŸããŸãªã¢ããªãã£ã䜿çšããå Žåã§ããããã¹ãã®å ¥åãšåºåãå¿ èŠã§ãããã®å®è£ ã¯ç»åãšé³å£°ãªããžã§ã¯ããšé£æºããŸããçŸæç¹ã§ã¯ãããã2ã€ã¯äºææ§ããããŸãããããµããŒããåäžãããããã«åãçµãã§ãããè¿ éã«äºææ§ãåäžããã§ãããã
Future compatibility with Langchain
ç§ãã¡ã¯LangchainãæããŠãããéåžžã«é åçãªããŒã«ã®ã¹ã€ãŒããæã£ãŠãããšèããŠããŸãããããã®ããŒã«ãæ±ãããã«ãLangchainã¯ããŸããŸãªã¢ããªãã£ã§äœæ¥ããå Žåã§ããããã¹ãã®å ¥åºåãå¿ èŠã§ããããã¯ããªããžã§ã¯ãã®ã·ãªã¢ã«åããŒãžã§ã³ïŒã€ãŸãããã£ã¹ã¯ã«ä¿åãããããŒãžã§ã³ïŒã§ããããšãå€ãã§ãã
ãã®éãã«ãããtransformers-agentsãšlangchainéã§ã¯ãã«ãã¢ããªãã£ãåŠçãããŠããŸããã ãã®å¶éã¯å°æ¥ã®ããŒãžã§ã³ã§è§£æ±ºãããããšãç®æããŠãããç±å¿ãªlangchainãŠãŒã¶ãŒããã®ä»»æã®æ¯æŽãæè¿ããŸãã
ç§ãã¡ã¯ããè¯ããµããŒããæäŸããããšèããŠããŸãããæäŒãããã ããå Žåã¯ããã²åé¡ãéããŠããèãã®ããšãå ±æããŠãã ããã