Saravanan666/pypi-org huggingface dataset:
Package: llama-index-tools-database
Database ToolThis tool connects to a database (using SQLAlchemy under the hood) and allows an Agent to query the database and get information about the tables.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereandhereHere's an example usage of the DatabaseToolSpec.fromllama_index.tools.databaseimportDatabaseToolSpecfromllama_index.agentimportOpenAIAgentdb_tools=DatabaseToolSpec(scheme="postgresql",# Database Schemehost="localhost",# Database Hostport="5432",# Database Portuser="postgres",# Database Userpassword="FakeExamplePassword",# Database Passworddbname="postgres",# Database Name)agent=OpenAIAgent.from_tools(db_tools.to_tool_list())agent.chat("What tables does this database contain")agent.chat("Describe the first table")agent.chat("Retrieve the first row of that table")The tools available are:list_tables: A tool to list the tables in the database schemadescribe_tables: A tool to describe the schema of a tableload_data: A tool that accepts an SQL query and returns the resultThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-exa
LlamaIndex Tools Integration: ExaThis tool connects toExato easily enable
your agent to search and get HTML content from the Internet.To begin, you need to obtain an API key on theExa developer dashboard.UsageThis tool has more a extensive example usage documented in a Jupyter notebookhereHere's an example usage of the ExaToolSpec.fromllama_index.tools.exaimportExaToolSpecfromllama_index.agent.openaiimport(OpenAIAgent,)# requires llama-index-agent-openaiexa_tool=ExaToolSpec(api_key="your-key",)agent=OpenAIAgent.from_tools(exa_tool.to_tool_list())agent.chat("Can you summarize the news published in the last month on superconductors")search: Search for a list of articles relating to a natural language queryretrieve_documents: Retrieve a list of documents returned fromexa_search.search_and_retrieve_documents: Combines search and retrieve_documents to directly return a list of documents related to a searchfind_similar: Find similar documents to a given URL.current_date: Utility for the Agent to get todays dateThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-finance
Finance Agent ToolThis tool connects to various open finance apis and libraries to gather news, earnings information and doing fundamental analysis.To use this tool, you'll need a few API keys:POLYGON_API_KEY --https://polygon.io/FINNHUB_API_KEY --https://finnhub.io/ALPHA_VANTAGE_API_KEY --https://www.alphavantage.co/NEWSAPI_API_KEY --https://newsapi.org/Installationpip install llama-index-tools-financeUsagefromllama_index.agent.openaiimportOpenAIAgentfromllama_index.llms.openaiimportOpenAIfromllama_index.tools.financeimportFinanceAgentToolSpecPOLYGON_API_KEY=""FINNHUB_API_KEY=""ALPHA_VANTAGE_API_KEY=""NEWSAPI_API_KEY=""OPENAI_API_KEY=""GPT_MODEL_NAME="gpt-4-0613"defcreate_agent(polygon_api_key:str,finnhub_api_key:str,alpha_vantage_api_key:str,newsapi_api_key:str,openai_api_key:str,)->OpenAIAgent:tool_spec=FinanceAgentToolSpec(polygon_api_key,finnhub_api_key,alpha_vantage_api_key,newsapi_api_key,)llm=OpenAI(temperature=0,model=GPT_MODEL_NAME,api_key=openai_api_key)returnOpenAIAgent.from_tools(tool_spec.to_tool_list(),llm=llm,verbose=True)agent=create_agent(POLYGON_API_KEY,FINNHUB_API_KEY,ALPHA_VANTAGE_API_KEY,NEWSAPI_API_KEY,OPENAI_API_KEY,)response=agent.chat("What happened to AAPL stock on February 19th, 2024?")
Package: llama-index-tools-graphql
GraphQL ToolThis tool provides agents the ability to easily execute GraphQL queries against a server. The tool can be initialized with the server url and any required headers and thereafter perform queries against the serverUsageThis tool has a more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the GraphQLToolSpec.This tool works best when the Agent has access to the GraphQL schema for the server. Seeherefor an example of using a tool with a file loader to create even more powerful Agents.fromllama_index.tools.graphqlimportGraphQLToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=GraphQLToolSpec(url="https://spacex-production.up.railway.app/",headers={"content-type":"application/json",},)agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("get the id, model, name and type of the Ships from the graphql endpoint")graphql_request: Runs a GraphQL query against the configured serverThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-ionic-shopping
LlamaIndex Tools Integration: Ionic ShoppingIonicis a plug and play ecommerce marketplace for AI Assistants.
By including the Ionic Tool in your agent, you are effortlessly providing your users with the ability
to shop and transact directly within your agent, and you’ll get a cut of the transaction.AttributionLlearn more about howIonic attributes salesto your agent. Provide your Ionic API Key when instantiating the tool:fromllama_hub.tools.ionic_shopping.baseimportIonicShoppingToolSpecionic_tool=IonicShoppingToolSpec(api_key="<my Ionic API Key>").to_tool_list()UsageTry it out using theJupyter notebook.importopenaifromllama_index.agentimportOpenAIAgent# requires llama-index-agent-openaifromllama_hub.tools.ionic_shopping.baseimportIonicShoppingToolSpecopenai.api_key="sk-api-key"ionic_tool=IonicShoppingToolSpec(api_key="<my Ionic API Key>").to_tool_list()agent=OpenAIAgent.from_tools(ionic_tool)print(agent.chat("I'm looking for a 5k monitor can you find me 3 options between $600 and $1000"))query: used to search for products and to get product recommendationsYour users can use natural language to specify how many results they would like to see
and what their budget is.For more information on setting up your Agent with Ionic, see theIonic documentation.
Package: llama-index-tools-metaphor
Metaphor Tool================================================================================NOTE: Deprecated in favor of Exa Tool.================================================================================This tool connects toMetaphorto easily enable
your agent to search and get HTML content from the Internet.To begin, you need to obtain an API key on theMetaphor developer dashboard.UsageThis tool has more a extensive example usage documented in a Jupyter notebookhereHere's an example usage of the MetaphorToolSpec.fromllama_index.tools.metaphorimportMetaphorToolSpecfromllama_index.agentimportOpenAIAgentmetaphor_tool=MetaphorToolSpec(api_key="your-key",)agent=OpenAIAgent.from_tools(metaphor_tool.to_tool_list())agent.chat("Can you summarize the news published in the last month on superconductors")search: Search for a list of articles relating to a natural language queryretrieve_documents: Retrieve a list of documents returned frommetaphor_search.search_and_retrieve_documents: Combines search and retrieve_documents to directly return a list of documents related to a searchfind_similar: Find similar documents to a given URL.current_date: Utility for the Agent to get todays dateThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-multion
MultiOn ToolThis tool connects toMultiOnto enable your agent to easily
connect to the internet through your Chrome Web browser and act on your behalfYou will need to have the MultiOn chrome extension installed and a MultiOn account
to use this integrationUsageThis tool has more a extensive example usage documented in a Jupyter notebookhereHere's an example usage of the MultionToolSpec.fromllama_index.tools.metaphorimportMultionToolSpecfromllama_index.agentimportOpenAIAgentmultion_tool=MultionToolSpec()agent=OpenAIAgent.from_tools(multion_tool.to_tool_list())agent.chat("Can you read the latest tweets from my followers")agent.chat("What's the next thing on my google calendar?")browse: The core function that takes natural language instructions to pass to the web browser to executeThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-neo4j
Neo4j Schema Query BuilderTheNeo4jQueryToolSpecclass provides a way to query a Neo4j graph database based on a provided schema definition. The class uses a language model to generate Cypher queries from user questions and has the capability to recover from Cypher syntax errors through a self-healing mechanism.Table of ContentsUsageInitializationRunning a QueryFeaturesUsageInitializationInitialize theNeo4jQueryToolSpecclass with:fromllama_index.tools.neo4j_dbimportNeo4jQueryToolSpecfromllama_index.llmsimportOpenAIfromllama_index.agentimportOpenAIAgentllm=OpenAI(model="gpt-4",openai_api_key="XXXX-XXXX",temperature=0)gds_db=Neo4jQueryToolSpec(url="neo4j-url",user="neo4j-user",password="neo4j=password",llm=llm,database="neo4j",)tools=gds_db.to_tool_list()agent=OpenAIAgent.from_tools(tools,verbose=True)Where:url: Connection string for the Neo4j database.user: Username for the Neo4j database.password: Password for the Neo4j database.llm: A language model for generating Cypher queries (any type of LLM).database: The database name.Running a QueryTo use the agent:# use agentagent.chat("Where is JFK airport is located?")Generated Cypher:

MATCH (p:Port {port_code: 'JFK'})
RETURN p.location_name_wo_diacritics AS Location

Final answer:
'The port code JFK is located in New York, United States.'FeaturesSchema-Based Querying: The class extracts the Neo4j database schema to guide the Cypher query generation.Self-Healing: On a Cypher syntax error, the class corrects itself to produce a valid query.Language Model Integration: Uses a language model for natural and accurate Cypher query generation.
Package: llama-index-tools-notion
Notion ToolThis tool loads and updates documents from Notion. The user specifies an API token to initialize the NotionToolSpec.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the NotionToolSpec.fromllama_index.tools.notionimportNotionToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=NotionToolSpec()agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("Append the heading 'I am legend' to the movies page")load_data: Loads a list of page or databases by idsearch_data: Searches for matching pages or databasesappend_data: Appends content to the matching page or databaseThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-openai-image-generation
OpenAI Image Generation ToolThis tool allows Agents to generate images using OpenAI's DALL-E model. To see more and get started, visithttps://openai.com/blog/dall-e/UsageThis tool has a more extensive example usage documented in a Jupyter notebookhereUsage with Agentfromllama_index.tools.openai.image_generationimport(OpenAIImageGenerationToolSpec,)image_generation_tool=OpenAIImageGenerationToolSpec(api_key=os.environ["OPENAI_API_KEY"])agent=OpenAIAgent.from_tools([*image_generation_tool.to_tool_list()],verbose=True,)response=agent.query("A pink and blue llama in a black background with the output")print(response)Usage directlyfromllama_index.tools.openai.image_generationimport(OpenAIImageGenerationToolSpec,)image_generation_tool=OpenAIImageGenerationToolSpec(api_key=os.environ["OPENAI_API_KEY"])image_data=image_generation_tool.image_generation(text="A pink and blue llama with a black background",response_format="b64_json",)image_bytes=base64.b64decode(image_data)img=Image.open(BytesIO(image_bytes))display(img)image_generation: Takes an text input and generates an imageThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-openapi
OpenAPI ToolThis tool loads an OpenAPI spec and allow the Agent to retrieve endpoints and details about endpoints. The RequestsToolSpec can also be loaded into the agent to allow the agent to hit the necessary endpoints with a REST request.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the OpenAPIToolSpec.fromllama_hub.tools.openapiimportOpenAPIToolSpecfromllama_index.agentimportOpenAIAgentf=requests.get("https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml").textopen_api_spec=yaml.safe_load(f)# ORopen_spec=OpenAPIToolSpec(url="https://raw.githubusercontent.com/APIs-guru/openapi-directory/main/APIs/openai.com/1.2.0/openapi.yaml")tool_spec=OpenAPIToolSpec(open_api_spec)agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("What is the base url for the API")agent.chat("What parameters does the x endpoint need?")load_openapi_spec: Returns the parsed OpenAPI spec that the class was initialized withThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-python-file
Python File ToolThis tool loads a python file and extracts function names, arguments and descriptions automatically. This tool is particular useful for automatically creating custom Tool Specs when you already have well documented python functions.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the PythonFileToolSpec.fromllama_index.tools.python_fileimportPythonFileToolSpecfromllama_index.agentimportOpenAIAgentpyfile=PythonFileToolSpec("./numpy_linalg.py")agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("""Load the eig, transpose and solve functions from the python file,and then write a function definition using only builtin python types (List, float, Tuple)with a short 5-10 line doc string tool prompts for the functions that only has a small description and arguments""")function_definitions: Get all of the function definitions from the Python fileget_function: Get a specific function definition from the Python fileget_functions: Get a list of functions from the python fileThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-requests
Requests ToolThis tool provides the agent the ability to make HTTP requests. It can be combined with the OpenAPIToolSpec to interface with an OpenAPI server.For security reasons, you must specify the hostname for the headers that you wish to provide. Seehere for an exampleUsageThis tool has more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the RequestsToolSpec.fromllama_index.tools.requestsimportRequestsToolSpecfromllama_index.agentimportOpenAIAgentdomain_headers={"api.openai.com":{"Authorization":"Bearer sk-your-key","Content-Type":"application/json",}}tool_spec=RequestsToolSpec(domain_headers=domain_headers)agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("")get_request: Performs a get request against the URLpost_request: Performs a post request against the URLpatch_request: Performs a patch request against the URLThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-salesforce
Salesforce ToolThis tool connects to a Salesforce environment and allow the Agent to perform SOQL and SOSL queries.UsageThis tool is a wrapper tool using the simple salesforce library. More information on this libraryhereHere's an example usage of the Salesforce Tool:fromllama_index.tools.salesforceimportSalesforceToolSpec# Initialize the tool with your Salesforce credentials and other relevant detailssf=SalesforceToolSpec(username=sf_username,password=sf_password,consumer_key=sf_consumer_key,consumer_secret=sf_consumer_secret,domain="test",)agent=OpenAIAgent.from_tools(sf.to_tool_list(),llm=llm,verbose=True,system_prompt=system_prompt,memory=memory,)agent.chat("List 3 Accounts in Salesforce")agent.chat("Provide information on a customer account John Doe")execute_sosl- Returns the result of a Salesforce search as a dict decoded from the Salesforce response JSON payload.execute_soql- Returns the full set of results for thequery. The returned dict is the decoded JSON payload from the final call to Salesforce, but with thetotalSizefield representing the full number of results retrieved and therecordslist representing the full list of records retrieved.This loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-shopify
Shopify ToolThis tool acts as a custom app for Shopify stores, allowing the Agent to execute GraphQL queries to gather information or perform mutations against the Shopify store.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereIn particular, the tool is very effective when combined with a method of retrieving data from the GraphQL schema definition.fromllama_index.tools.shopifyimportShopifyToolSpecfromllama_index.agentimportOpenAIAgentfromllama_index.file.unstructuredimportUnstructuredReaderfromllama_index.tools.ondemand_loader_toolimportOnDemandLoaderTooldocumentation_tool=OnDemandLoaderTool.from_defaults(UnstructuredReader(),name="graphql_writer",description="""The GraphQL schema file is located at './data/shopify_graphql.txt', this is always the file argument.A tool for processing the Shopify GraphQL spec, and writing queries from the documentation.You should pass a query_str to this tool in the form of a request to write a GraphQL query.Examples:file: './data/shopify_graphql.txt', query_str='Write a graphql query to find unshipped orders'file: './data/shopify_graphql.txt', query_str='Write a graphql query to retrieve the stores products'file: './data/shopify_graphql.txt', query_str='What fields can you retrieve from the orders object'""",)shopify_tool=ShopifyToolSpec("your-store.myshopify.com","2023-04","your-api-key")agent=OpenAIAgent.from_tools([*shopify_tool.to_tool_list(),documentation_tool],system_prompt=f"""You are a specialized Agent with access to the Shopify Admin GraphQL API for this Users online store.Your job is to chat with store owners and help them run GraphQL queries, interpreting the results for the userYou can use graphql_writer to query the schema and assist in writing queries.If the GraphQL you execute returns an error, either directly fix the query, or directly ask the graphql_writer questions about the schema instead of writing graphql queries.Then use that information to write the correct graphql query""",verbose=True,max_function_calls=20,)agent.chat("What products are in my store?")run_graphql_query: Executes a GraphQL query against the Shopify storeThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-slack
Slack ToolThis tool fetches the text from a list of Slack channels. You will need to initialize the loader with your Slack API Token or have theSLACK_BOT_TOKENenvironment variable set.Usagefromllama_index.tools.slackimportSlackToolSpecfromllama_index.agentimportOpenAIAgenttool_spec=SlackToolSpec(slack_token="token")agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("What is the most recent message in the announcements channel?")load_data: Loads messages from a list of channelssend_message: Sends a message to a channelfetch_channel: Fetches the list of channelsThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-tavily-research
Tavily Research ToolTavilyis a robust research API tailored specifically for LLM Agents. It seamlessly integrates with diverse data sources to ensure a superior, relevant research experience.To begin, you need to obtain an API key on theTavily's developer dashboard.Why Choose Tavily Research API?Purpose-Built: Tailored just for LLM Agents, we ensure our features and results resonate with your unique needs. We take care of all the burden in searching, scraping, filtering and extracting information from online sources. All in a single API call!Versatility: Beyond just fetching results, Tavily Research API offers precision. With customizable search depths, domain management, and parsing html content controls, you're in the driver's seat.Performance: Committed to rapidity and efficiency, our API guarantees real-time outcomes without sidelining accuracy. Please note that we're just getting started, so performance may vary and improve over time.Integration-friendly: We appreciate the essence of adaptability. That's why integrating our API with your existing setup is a breeze. You can choose our Python library or a simple API call or any of our supported partners such asLangchainandLLamaIndex.Transparent & Informative: Our detailed documentation ensures you're never left in the dark. From setup basics to nuanced features, we've got you covered.UsageThis tool has a more extensive example usage documented in a Jupyter notebookhereHere's an example usage of the TavilyToolSpec.fromllama_index.tools.tavily_researchimportTavilyToolSpecfromllama_index.agentimportOpenAIAgenttavily_tool=TavilyToolSpec(api_key="your-key",)agent=OpenAIAgent.from_tools(tavily_tool.to_tool_list())agent.chat("What happened in the latest Burning Man festival?")search: Search for relevant dynamic data based on a query. Returns a list of urls and their relevant content.This loader is designed to be used as a way to load data as a Tool in an Agent. Seeherefor examples.
Package: llama-index-tools-text-to-image
Text to Image ToolThis tool allows Agents to use the OpenAI Image endpoint to generate and create variations of images.UsageThis tool has more extensive example usage documented in a Jupyter notebookhereAnother example showcases retrieval augmentation over a knowledge corpus with text-to-image.Notebook.fromllama_index.tools.text_to_imageimportTextToImageToolSpecfromllama_index.agentimportOpenAIAgentopenai.api_key="sk-your-key"tool_spec=TextToImageToolSpec()# ORtool_spec=TextToImageToolSpec(api_key="sk-your-key")agent=OpenAIAgent.from_tools(tool_spec.to_tool_list())agent.chat("show 2 images of a beautiful beach with a palm tree at sunset")agent.chat("make the second image higher quality")generate_images: Generate images from a prompt, specifying the number of images and resolutionshow_images: Show the images using matplot, useful for Jupyter notebooksgenerate_image_variation: Generate a variation of an image given a URL.This loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.
Package: llama-index-tools-vector-db
VectorDB ToolThis tool wraps a VectorStoreIndex and enables a agent to call it with queries and filters to retrieve data.Usagefromllama_index.tools.vector_dbimportVectorDBfromllama_index.agentimportOpenAIAgentfromllama_index.vector_stores.typesimportVectorStoreInfofromllama_indeximportVectorStoreIndexindex=VectorStoreIndex(nodes=nodes)tool_spec=VectorDB(index=index)vector_store_info=VectorStoreInfo(content_info="brief biography of celebrities",metadata_info=[MetadataInfo(name="category",type="str",description="Category of the celebrity, one of [Sports, Entertainment, Business, Music]",),MetadataInfo(name="country",type="str",description="Country of the celebrity, one of [United States, Barbados, Portugal]",),],)agent=OpenAIAgent.from_tools(tool_spec.to_tool_list(func_to_metadata_mapping={"auto_retrieve_fn":ToolMetadata(name="celebrity_bios",description=f"""\Use this tool to look up biographical information about celebrities.The vector database schema is given below:{vector_store_info.json()}{tool_spec.auto_retrieve_fn.__doc__}""",fn_schema=create_schema_from_function("celebrity_bios",tool_spec.auto_retrieve_fn),)}),verbose=True,)agent.chat("Tell me about two celebrities from the United States. ")auto_retrieve_fn: Retrieves data from the indexThis loader is designed to be used as a way to load data as a Tool in a Agent. Seeherefor examples.