async def ingest(self, ctx: Context, ev: StartEvent) -> Optional[StopEvent]:
        """Ingest step (for ingesting docs and initializing index)."""
        documents: Optional[List[Document]] = ev.get("documents")
        tavily_ai_apikey: Optional[str] = ev.get("tavily_ai_apikey")

        if any(i is None for i in [documents, tavily_ai_apikey]):
            return None

        llm = OpenAI(model="gpt-4")
        ctx.data["relevancy_pipeline"] = QueryPipeline(
            chain=[DEFAULT_RELEVANCY_PROMPT_TEMPLATE, llm]
        )
        ctx.data["transform_query_pipeline"] = QueryPipeline(
            chain=[DEFAULT_TRANSFORM_QUERY_TEMPLATE, llm]
        )

        ctx.data["llm"] = llm
        ctx.data["index"] = VectorStoreIndex.from_documents(documents)
        ctx.data["tavily_tool"] = TavilyToolSpec(api_key=tavily_ai_apikey)

        return StopEvent()
Ingest step (for ingesting docs and initializing index).
llama-index-packs/llama-index-packs-corrective-rag/llama_index/packs/corrective_rag/base.py