Before You Get Started

To use the Search API, you will need an API key. Please visit for more details.

Enriching OpenAI’s LLM with the Search API and LangChain

Follow these steps to query’s Search API and enrich LLM responses with our snippets. You will need to have the environment variables AUTH_KEY and OPENAI_API_KEY set to follow along with this guide.

1. Install

pip install openai langchain

2. Create a LangChain RetrievalQA chain using YouRetriever and GPT-3.5 Turbo
import os

from import YouRetriever
from langchain.chains import RetrievalQA
from langchain.chat_models import ChatOpenAI

os.environ["YDC_API_KEY"] = "YOUR YOU.COM API KEY"
yr = YouRetriever()
model = "gpt-3.5-turbo-16k"
qa = RetrievalQA.from_chain_type(llm=ChatOpenAI(model=model), chain_type="stuff", retriever=yr)

3. Now run the chain"how was the New York City pinball ban lifted?")