Skip to content

feat: add Ollama and AWS Bedrock AI assistants - #1729

Open
singhankur wants to merge 1 commit into
pinterest:masterfrom
singhankur:feat/ollama-bedrock-ai-assistants
Open

feat: add Ollama and AWS Bedrock AI assistants#1729
singhankur wants to merge 1 commit into
pinterest:masterfrom
singhankur:feat/ollama-bedrock-ai-assistants

Conversation

@singhankur

Copy link
Copy Markdown

Summary

This PR adds two new AI assistant implementations to complement the existing OpenAI assistant:

  • OllamaAIAssistant — integrates with locally hosted Ollama models via langchain-ollama. Useful for air-gapped or on-prem deployments that can't use cloud APIs.
  • BedrockAIAssistant — integrates with AWS Bedrock via langchain-aws (ChatBedrock). Uses the standard boto3 credential chain (IAM roles, environment variables, ~/.aws/credentials) — no custom proxy or auth headers needed.

Both follow the existing plugin pattern: drop in the class and register it in plugins/ai_assistant_plugin/__init__.py.

Files changed

File Description
querybook/server/lib/ai_assistant/assistants/ollama_assistant.py New OllamaAIAssistant class
querybook/server/lib/ai_assistant/assistants/bedrock_assistant.py New BedrockAIAssistant class
plugins/ai_assistant_plugin/__init__.py Usage examples for both assistants
requirements/ai/langchain.txt Add langchain-ollama and langchain-aws

Configuration

Ollama

Set the OLLAMA_BASE_URL environment variable (defaults to http://localhost:11434) and enable the assistant in your plugin:

from lib.ai_assistant.assistants.ollama_assistant import OllamaAIAssistant
ALL_PLUGIN_AI_ASSISTANTS = [OllamaAIAssistant()]

Config example (in Querybook admin settings):

{
  "default": {
    "model_args": { "model_name": "llama3.2" }
  }
}

AWS Bedrock

Requires valid boto3 credentials (IAM role or ~/.aws/credentials):

from lib.ai_assistant.assistants.bedrock_assistant import BedrockAIAssistant
ALL_PLUGIN_AI_ASSISTANTS = [BedrockAIAssistant()]

Config example:

{
  "default": {
    "model_args": {
      "model_id": "anthropic.claude-3-5-haiku-20241022-v1:0",
      "region_name": "us-east-1"
    }
  }
}

Supported models include Amazon Nova, Anthropic Claude 3.x, Meta Llama 3, and Mistral families.

Test plan

  • Run Querybook locally with Ollama server running and verify query generation works end-to-end
  • Run Querybook with AWS credentials and verify Bedrock assistant responds correctly
  • Confirm existing OpenAI assistant is unaffected
  • Check that langchain-ollama and langchain-aws install cleanly alongside existing deps

Add two new AI assistant implementations:

- OllamaAIAssistant: integrates with locally hosted Ollama models via
  langchain-ollama. Configured via OLLAMA_BASE_URL env var or base_url
  in model_args. Defaults to llama3.2.

- BedrockAIAssistant: integrates with AWS Bedrock via langchain-aws
  (ChatBedrock). Uses standard boto3 credential chain — no custom proxy
  or auth headers required. Defaults to claude-3-5-haiku.

Both assistants follow the existing plugin pattern and are registered
as examples in plugins/ai_assistant_plugin/__init__.py.

Adds langchain-ollama and langchain-aws to requirements/ai/langchain.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant