code: def build_rag_pipeline(
      document_store: DocumentStore,
      embedding_model: str = "intfloat/e5-base-v2",
      generation_model: str = "gpt-3.5-turbo",
      llm_api_key: Optional[str] = None,
      prompt_template: Optional[str] = None,
  ):
      """
      Returns a prebuilt pipeline to perform retrieval augmented generation
      :param document_store: An instance of a DocumentStore to read from.
      :param embedding_model: The name of the model to use for embedding. Only SentenceTransformer models supported in this getting started code.
      :param prompt_template: The template to use for the prompt. If not given, a default RAG template is used.
      :param generation_model: The name of the model to use for generation.
                               Currently supporting: OpenAI generation models and Huggingface TGI models for text generation
      :param llm_api_key: The API key to use for the OpenAI Language Model. If not given, the value of the
                          llm_api_key will be attempted to be read from the environment variable OPENAI_API_KEY.
      """
      # Resolve components based on the chosen parameters
      retriever = resolve_retriever(document_store)
      embedder = resolve_embedder(embedding_model)
      generator = resolve_generator(generation_model, llm_api_key)
      prompt_template = resolve_prompt_template(prompt_template)
  
      # Add them to the Pipeline and connect them
      pipeline = _RAGPipeline(
          retriever=retriever,
          embedder=embedder,
          generator=generator,
          prompt_template=prompt_template,
      )
      return pipeline
  
imports: import re
  from abc import ABC, abstractmethod
  from typing import Optional, Any
  from huggingface_hub import HfApi
  from haystack import Pipeline
  from haystack.components.builders.answer_builder import AnswerBuilder
  from haystack.components.builders.prompt_builder import PromptBuilder
  from haystack.components.embedders import SentenceTransformersTextEmbedder
  from haystack.components.generators import OpenAIGenerator, HuggingFaceTGIGenerator
  from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
  from haystack.dataclasses import Answer
  from haystack.document_stores.types import DocumentStore
  from haystack.document_stores.in_memory import InMemoryDocumentStore
label_desc: Use image node_id 1 for calling a global function with example usage: build_rag_pipeline(document_store, embedding_model, generation_model, llm_api_key, prompt_template) and returns: pipeline