llama-index

Форк
0

8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
README.md

LoadAndSearch Tool

This Tool Spec is intended to wrap other tools, allowing the Agent to perform separate loading and reading of data. This is very useful for when tools return information larger than or closer to the size of the context window.

Usage

Here's an example usage of the LoadAndSearchToolSpec.

from llama_index.legacy.tools.tool_spec.load_and_search import (
LoadAndSearchToolSpec,
)
from llama_index.legacy.agent import OpenAIAgent
from llama_hub.tools.wikipedia.base import WikipediaToolSpec
wiki_spec = WikipediaToolSpec()
# Get the search_data tool from the wikipedia tool spec
tool = wiki_spec.to_tool_list()[1]
# Wrap the tool, splitting into a loader and a reader
agent = OpenAIAgent.from_tools(
LoadAndSearchToolSpec.from_defaults(tool).to_tool_list(), verbose=True
)
agent.chat("who is ben affleck married to")

load: Calls the wrapped function and loads the data into an index read: Searches the index for the specified query

This loader is designed to be used as a way to load data as a Tool in a Agent. See here for examples.

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.