knowledge

command
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 5 Imported by: 0

README

Knowledge Sources Example

Demonstrates RAG document ingestion with three source types working together:

  • TextFileSource — unstructured text (DraftCrew overview)
  • CSVSource — structured tabular data (feature tracker)
  • JSONSource — hierarchical data (build metrics)

The agent indexes all three files via draftRAG (Ollama embedder) and answers questions that require knowledge from different sources.

Prerequisites

  • Ollama running (default: http://localhost:11434)
  • An embedding model: ollama pull nomic-embed-text or ollama pull embeddinggemma:300m
  • An LLM model: ollama pull gemma3:4b

Usage

OLLAMA_BASE_URL=http://localhost:11434 \
  OLLAMA_MODEL=gemma3:4b \
  LLM_EMBED_MODEL=embeddinggemma:300m \
  go run main.go
OpenAI LLM + Ollama embedder
OPENAI_API_KEY=sk-... \
  LLM_EMBED_MODEL=nomic-embed-text \
  go run main.go
Customising the embedder
Env var Default Purpose
LLM_BASE_URL http://localhost:11434/v1 Embedder API endpoint
LLM_API_KEY ollama Embedder API key
LLM_EMBED_MODEL nomic-embed-text Embedding model name

What the agent answers

  1. Which process types does DraftCrew support? (from txt)
  2. Which features are done vs pending? (from csv)
  3. Current version, packages count, test coverage? (from json)
  4. What RAG engine does it use? (from txt + json)

Notes

  • Sources are loaded eagerly at agent init — one shared Pipeline (embedder + store) for all sources
  • Each source is idempotent: calling Load() twice is a no-op
  • If a source file is missing or malformed, the agent logs a warning and continues without it

Documentation

Overview

@sk-task knowledge-sources#T4.2: knowledge example

This example demonstrates multiple knowledge source types:

  • TextFileSource — unstructured text
  • CSVSource — structured tabular data
  • JSONSource — hierarchical data

The agent reads all three files, indexes them via draftRAG (Ollama embedder), and answers questions based on the combined knowledge.

Prerequisites:

  • Ollama running at http://localhost:11434
  • An embedding model pulled (e.g. nomic-embed-text or embeddinggemma:300m)
  • An LLM model pulled for the agent (e.g. gemma3:4b)

Usage (Ollama LLM + Ollama embedder — recommended):

OLLAMA_BASE_URL=http://localhost:11434 \
  OLLAMA_MODEL=gemma3:4b \
  LLM_EMBED_MODEL=nomic-embed-text \
  go run main.go

Usage (OpenAI LLM + Ollama embedder):

OPENAI_API_KEY=sk-... \
  LLM_EMBED_MODEL=nomic-embed-text \
  go run main.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL