Haystack is an open-source framework for building LLM applications with composable pipelines. The Keywords AI gateway integration routes your LLM calls through Keywords AI for automatic logging, fallbacks, load balancing, and cost optimization.
Use platform-managed prompts for centralized control:
import osfrom haystack import Pipelinefrom keywordsai_exporter_haystack import KeywordsAIGenerator# Create pipeline with platform prompt# No model needed - it comes from the platformpipeline = Pipeline()pipeline.add_component("llm", KeywordsAIGenerator( prompt_id="your-prompt-id", # Get from platform api_key=os.getenv("KEYWORDSAI_API_KEY")))# Run with prompt variablesresult = pipeline.run({ "llm": { "prompt_variables": { "user_input": "your text here" } }})