that we have the documentation content in chunks, let's put all this information in a vector index for easy retrieval.search_index = Vectara.from_texts(source_chunks, embedding=None)Set Up LLM Chain with Custom Prompt‚ÄãNext, let's set up a simple LLM chain but give it a custom prompt for blog post generation. Note that the custom prompt is parameterized and takes two inputs: context, which will be the documents fetched from the vector search, and topic, which is given by the user.from langchain.chains import LLMChainprompt_template = """Use the context below to write a 400 word blog post about the topic below:    Context: {context}    Topic: {topic}    Blog post:"""PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "topic"])llm = OpenAI(openai_api_key=os.environ["OPENAI_API_KEY"], temperature=0)chain = LLMChain(llm=llm, prompt=PROMPT)Generate Text‚ÄãFinally, we write a function to apply our inputs to the chain. The function takes an input parameter topic. We find the documents in the vector index that correspond to that topic, and use them as additional context in our simple LLM chain.def generate_blog_post(topic):    docs = search_index.similarity_search(topic, k=4)    inputs = [{"context": doc.page_content, "topic": topic} for doc in docs]    print(chain.apply(inputs))generate_blog_post("environment variables")    [{'text': '\n\nWhen it comes to running Deno CLI tasks, environment variables can be a powerful tool for customizing the behavior of your tasks. With the Deno Task Definition interface, you can easily configure environment variables to be set when executing your tasks.\n\nThe Deno Task Definition interface is configured in a `tasks.json` within your workspace. It includes a `env` field, which allows you to specify any environment variables that should be set when executing the task. For example, if you wanted to set the `NODE_ENV` environment variable to `production` when running a Deno task, you could add the following to
This notebook is based on text generation notebook and adapted to Vectara.
This notebook is based on text generation notebook and adapted to Vectara. ->: that we have the documentation content in chunks, let's put all this information in a vector index for easy retrieval.search_index = Vectara.from_texts(source_chunks, embedding=None)Set Up LLM Chain with Custom Prompt‚ÄãNext, let's set up a simple LLM chain but give it a custom prompt for blog post generation. Note that the custom prompt is parameterized and takes two inputs: context, which will be the documents fetched from the vector search, and topic, which is given by the user.from langchain.chains import LLMChainprompt_template = """Use the context below to write a 400 word blog post about the topic below:    Context: {context}    Topic: {topic}    Blog post:"""PROMPT = PromptTemplate(template=prompt_template, input_variables=["context", "topic"])llm = OpenAI(openai_api_key=os.environ["OPENAI_API_KEY"], temperature=0)chain = LLMChain(llm=llm, prompt=PROMPT)Generate Text‚ÄãFinally, we write a function to apply our inputs to the chain. The function takes an input parameter topic. We find the documents in the vector index that correspond to that topic, and use them as additional context in our simple LLM chain.def generate_blog_post(topic):    docs = search_index.similarity_search(topic, k=4)    inputs = [{"context": doc.page_content, "topic": topic} for doc in docs]    print(chain.apply(inputs))generate_blog_post("environment variables")    [{'text': '\n\nWhen it comes to running Deno CLI tasks, environment variables can be a powerful tool for customizing the behavior of your tasks. With the Deno Task Definition interface, you can easily configure environment variables to be set when executing your tasks.\n\nThe Deno Task Definition interface is configured in a `tasks.json` within your workspace. It includes a `env` field, which allows you to specify any environment variables that should be set when executing the task. For example, if you wanted to set the `NODE_ENV` environment variable to `production` when running a Deno task, you could add the following to