Skip to content

Instantly share code, notes, and snippets.

@idontcalculate
Created December 13, 2023 04:54
Show Gist options
  • Save idontcalculate/b4a7f778c08d8e5cad5e9c082ab33e11 to your computer and use it in GitHub Desktop.
Save idontcalculate/b4a7f778c08d8e5cad5e9c082ab33e11 to your computer and use it in GitHub Desktop.
from llama_index.agent import FnRetrieverOpenAIAgent
from llama_index.llms import OpenAI
# Initialize the LLM
llm = OpenAI(model="gpt-3.5-turbo-0613")
# Initialize the FnRetrieverOpenAIAgent
top_agent = FnRetrieverOpenAIAgent.from_retriever(
obj_index.as_retriever(similarity_top_k=4),
system_prompt=""" \
You are an agent designed to answer queries about a set of given patents.
Please always use the tools provided to answer a question. Do not rely on prior knowledge.\
""",
llm=llm,
verbose=True,
)
# baseline
response = base_query_engine.query(
"Tell me about the Death Ray"
)
print(str(response))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment