llama-index-integrations/tools/llama-index-tools-linkup-research/examples/linkup.ipynb
This tutorial walks through using the LLM tools provided by the Linkup API to allow LLMs to easily search and retrieve relevant content from the Internet.
To get started, you will need an OpenAI api key and a Linkup API key
We will import the relevant agents and tools and pass them our keys here:
%pip install llama-index-tools-linkup-research llama-index
# set your openai key, if using openai
import os
from llama_index.llms.openai import OpenAI
os.environ["OPENAI_API_KEY"] = "sk-..."
# Set up Linkup tool
from llama_index.tools.linkup_research.base import LinkupToolSpec
# structured_schema=json.dumps(your schema here) # Only if output type is structured
# Initialisation of the tool
linkup_tool = LinkupToolSpec(
api_key="your Linkup API Key",
depth="", # Choose (standard) for a faster result (deep) for a slower but more complete result.
output_type="", # Choose (searchResults) for a list of results relative to your query, (sourcedAnswer) for an answer and a list of sources, or (structured) if you want a specific shema.
# structured_output_schema=structured_schema # Only if output type is structured
)
# Call the agent
from llama_index.core.agent import FunctionAgent
agent = FunctionAgent(
tools=linkup_tool.to_tool_list(),
llm=OpenAI(model="gpt-4o"),
)
# Query for the agent
print(await agent.run("Can you tell me which women were awarded the Physics Nobel Prize"))