Version current

RedisVL

A powerful, AI-native Go client library for Redis. Leverage the speed, flexibility, and reliability of Redis for real-time data to supercharge your AI application.

What is RedisVL?

RedisVL is a comprehensive Go library for building AI-native applications with Redis. It provides a high-level interface for:

  • Vector similarity search with advanced filtering

  • Schema-based index management from YAML or programmatic configuration

  • Hybrid queries combining vector search with metadata filters and full-text scoring

  • Semantic and embedding caching for LLM applications

  • Local, in-process embedding models via ONNX Runtime — no API keys required

  • Flexible storage with both Redis Hash and JSON support

RedisVL for Golang is a port of the popular Python RedisVL library, bringing these capabilities to the Go ecosystem with idiomatic, context-aware APIs and goroutine-safe clients.

Resources

Getting Started

Learn the basics and create your first vector search application.

Get Started

Querying

Combine vector search with powerful metadata filtering.

Learn More

Semantic Caching

Cache LLM responses semantically to reduce costs and latency.

Explore Caching

Vectorizers

Create embeddings with hosted APIs or local ONNX models.

Choose a Vectorizer

Rerankers

Improve search quality with hosted or local cross-encoder models.

Boost Relevance

MCP Server

Expose your indices to AI agents via the Model Context Protocol.

Connect Agents

Features

RedisVL for Golang offers powerful features for AI-native applications:

  • Index Management - Design search schema and indices with ease from YAML or programmatic configuration

  • Advanced Vector Search - KNN, range, hybrid, and multi-vector queries with complex filtering support

  • Embedding Creation - OpenAI, Azure OpenAI, Cohere, Mistral, VoyageAI, Ollama, or local Hugging Face models via ONNX Runtime

  • Reranking - Improve search result quality with Cohere, VoyageAI, or local cross-encoder models

  • Semantic Caching - Cache LLM responses with semantic similarity, increasing QPS and decreasing system cost — self-hosted or via the managed LangCache service

  • Embeddings Cache - Cache vector embeddings to avoid redundant computation

  • Message History - Store chat history with recency- or relevancy-based retrieval

  • Semantic Routing - Route queries to topics and intents with vector similarity

  • Storage Flexibility - Choose between Hash and JSON storage based on your needs

  • Tooling - The rvl command-line interface and a built-in MCP server for AI agents

Installation

Add RedisVL to your project:

go get github.com/redis/redis-vl-golang@v0.2.0

For local embedding models (a separate module because it uses ONNX Runtime via cgo):

go get github.com/redis/redis-vl-golang/extensions/vectorize/hf@v0.2.0

Quick Example

package main

import (
    "context"
    "fmt"

    redisvl "github.com/redis/redis-vl-golang"
    "github.com/redis/redis-vl-golang/filter"
    "github.com/redis/redis-vl-golang/query"
    "github.com/redis/redis-vl-golang/schema"
)

func main() {
    ctx := context.Background()

    // Define the index schema
    vectorField, _ := schema.NewVectorField("embedding", schema.VectorAttrs{
        Dims: 384, Algorithm: schema.HNSW, Datatype: "float32",
        DistanceMetric: schema.Cosine,
    })
    s, _ := schema.NewIndexSchema(
        schema.IndexInfo{Name: "products", Prefixes: []string{"products"}},
        schema.NewTextField("description"),
        schema.NewTagField("category"),
        schema.NewNumericField("price"),
        vectorField,
    )

    // Create the index
    index, _ := redisvl.NewSearchIndexFromURL(s, "redis://localhost:6379")
    defer index.Close()
    index.Create(ctx)

    // Load data, then run a filtered vector search
    q := query.NewVectorQuery("embedding", queryVector).
        NumResults(5).
        Filter(filter.Tag("category").Eq("electronics").
            And(filter.Num("price").Le(100))).
        ReturnFields("description", "category", "price")

    results, _ := index.Query(ctx, q)
    fmt.Println(results)
}

Connecting with the Community

Join the Redis community to get help, share your experiences, and contribute: