Integrate OpenAI API Gateway with Haystack NLP framework. Build production-ready search and QA systems with document retrieval, question answering, and semantic search.
End-to-end NLP pipeline powered by OpenAI through gateway
Enterprise features for your NLP pipelines
Build a Haystack pipeline with Gateway
# Import Haystack and Gateway components from haystack import Pipeline from haystack.document_stores import InMemoryDocumentStore from haystack.nodes import EmbeddingRetriever from haystack.nodes import GatewayPromptNode # Create document store document_store = InMemoryDocumentStore(embedding_dim=1536) # Create retriever with gateway embeddings retriever = EmbeddingRetriever( document_store=document_store, embedding_model="text-embedding-3-small", gateway_endpoint="https://gateway.example.com", gateway_api_key="your-key" ) # Create prompt node with gateway prompt_node = GatewayPromptNode( model_name_or_path="gpt-4", gateway_endpoint="https://gateway.example.com", gateway_api_key="your-key", max_length=500, cache=True ) # Build pipeline pipeline = Pipeline() pipeline.add_node(retriever, name="Retriever", inputs=["Query"]) pipeline.add_node(prompt_node, name="Generator", inputs=["Retriever"]) # Run query result = pipeline.run(query="What is the main topic?") print(result["answers"][0].answer)
Gateway-ready components for your pipelines