RedisVectorStore 통합

RedisVectorStore 통합

LangChain JavaScript로 FluentRedisVectorStore와 RedisVectorStore와 통합해요.

**호환성**: Node.js에서만 사용할 수 있어요.

Redis는 빠른 오픈소스 인메모리 데이터 저장소예요. Redis 8.0부터 벡터 유사도 의미론 검색을 가능하게 하는 모듈인 RediSearch가 내장되어 별도 모듈 설치가 필요 없어졌어요. 이전 버전의 Redis에서는 모듈을 별도로 설치하거나 Redis Stack 배포를 사용해야 할 수 있어요.

이 가이드는 Redis 벡터 스토어 시작을 위한 빠른 개요를 제공해요. @langchain/redis 패키지는 두 가지 구현을 제공해요: FluentRedisVectorStore(권장, 고급 필터링 포함)와 RedisVectorStore(레거시).

개요 (Overview)

통합 세부 정보 (Integration details)

클래스 패키지 PY 지원 Downloads Version
FluentRedisVectorStore @langchain/redis NPM - Downloads NPM - Version
RedisVectorStore @langchain/redis NPM - Downloads NPM - Version

설정 (Setup)

Redis 벡터 스토어를 사용하려면 RediSearch가 활성화된 Redis Stack 인스턴스를 설정하고 @langchain/redis@langchain/core를 설치하세요. 자체 createClient 인스턴스를 RedisVectorStore에 전달할 때 redis Node.js 클라이언트를 설치하세요.

이 가이드는 OpenAI 임베딩을 예시로 사용해요. 대신 다른 지원 임베딩 모델을 사용할 수도 있어요.

```bash npm npm install @langchain/redis @langchain/core redis @langchain/openai ```
yarn add @langchain/redis @langchain/core redis @langchain/openai
pnpm add @langchain/redis @langchain/core redis @langchain/openai

이 지침을 따라 Docker로 Redis 인스턴스를 로컬에 설정할 수 있어요.

자격 증명 (Credentials)

REDIS_URL 환경 변수를 설정하세요:

process.env.REDIS_URL = "your-redis-url";

이 가이드에 OpenAI 임베딩을 사용한다면 OpenAI 키도 설정하세요:

process.env.OPENAI_API_KEY = "YOUR_API_KEY";

모델 호출의 자동 추적을 받으려면 아래 주석을 해제해 LangSmith API 키를 설정할 수도 있어요:

// process.env.LANGSMITH_TRACING="true"
// process.env.LANGSMITH_API_KEY="your-api-key"

인스턴스화 (Instantiation)

import { RedisVectorStore } from "@langchain/redis";
import { OpenAIEmbeddings } from "@langchain/openai";

import { createClient } from "redis";

const embeddings = new OpenAIEmbeddings({
  model: "text-embedding-3-small",
});

const client = createClient({
  url: process.env.REDIS_URL ?? "redis://localhost:6379",
});
await client.connect();

const vectorStore = new RedisVectorStore(embeddings, {
  redisClient: client,
  indexName: "langchainjs-testing",
});

벡터 스토어 관리 (Manage vector store)

벡터 스토어에 항목 추가 (Add items to vector store)

import type { Document } from "@langchain/core/documents";

const document1: Document = {
  pageContent: "The powerhouse of the cell is the mitochondria",
  metadata: { type: "example" },
};

const document2: Document = {
  pageContent: "Buildings are made out of brick",
  metadata: { type: "example" },
};

const document3: Document = {
  pageContent: "Mitochondria are made out of lipids",
  metadata: { type: "example" },
};

const document4: Document = {
  pageContent: "The 2024 Olympics are in Paris",
  metadata: { type: "example" },
};

const documents = [document1, document2, document3, document4];

await vectorStore.addDocuments(documents);

최상위 문서 id는 현재 지원되지 않지만, ID를 벡터 스토어에 직접 제공해 문서를 삭제할 수 있어요.

벡터 스토어 쿼리 (Query vector store)

직접 쿼리 (Query directly)

간단한 유사도 검색은 다음과 같이 수행할 수 있어요:

const similaritySearchResults = await vectorStore.similaritySearch(
  "biology",
  2
);

for (const doc of similaritySearchResults) {
  console.log(`* ${doc.pageContent} [${JSON.stringify(doc.metadata, null)}]`);
}

유사도 검색을 실행하고 대응하는 점수를 받으려면 다음을 실행할 수 있어요:

const similaritySearchWithScoreResults =
  await vectorStore.similaritySearchWithScore("biology", 2);

for (const [doc, score] of similaritySearchWithScoreResults) {
  console.log(
    `* [SIM=${score.toFixed(3)}] ${doc.pageContent} [${JSON.stringify(
      doc.metadata
    )}]`
  );
}
* [SIM=0.835] The powerhouse of the cell is the mitochondria [{"type":"example"}]
* [SIM=0.852] Mitochondria are made out of lipids [{"type":"example"}]

리트리버로 변환해 쿼리 (Query by turning into retriever)

벡터 스토어를 리트리버로 변환해 체인에서 더 쉽게 사용할 수도 있어요.

const retriever = vectorStore.asRetriever({
  k: 2,
});
await retriever.invoke("biology");

검색 증강 생성(RAG) 사용법 (Usage for retrieval-augmented generation)

이 벡터 스토어를 검색 증강 생성(RAG)에 사용하는 방법에 대한 가이드는 다음 섹션을 참고하세요:

문서 삭제 (Deleting documents)

벡터 스토어에서 문서를 두 가지 방법으로 삭제할 수 있어요:

모든 문서 삭제 (Delete all documents)

다음 명령으로 전체 인덱스와 모든 문서를 삭제할 수 있어요:

await vectorStore.delete({ deleteAll: true });

특정 문서를 ID로 삭제 (Delete specific documents by ID)

특정 문서를 ID로도 삭제할 수 있어요. 구성된 키 접두사(key prefix)가 제공한 ID에 자동으로 추가된다는 점을 유의하세요:

// The key prefix will be automatically added to each ID
await vectorStore.delete({ ids: ["doc1", "doc2", "doc3"] });

연결 닫기 (Closing connections)

과도한 리소스 소비를 피하기 위해 작업이 끝나면 클라이언트 연결을 닫으세요:

await client.disconnect();

고급 기능 (Advanced features)

Redis 벡터 스토어로 고급 사전 필터링

@langchain/redis 패키지는 두 가지 벡터 스토어 구현을 제공해요:

  • FluentRedisVectorStore (권장): 타입 안전한 fluent 필터링 API, 배열 기반 customSchema, GEO 필드, 타임스탬프 필터링을 갖춘 새 구현
  • RedisVectorStore (레거시): 객체 기반 스키마와 기본 필터링 기능을 갖춘 원래 구현
**어떤 것을 사용해야 하나요?**

새 프로젝트나 다음이 필요할 때는 FluentRedisVectorStore를 사용하세요:

  • 타입 안전한 fluent API로 고급 필터링 (Tag, Num, Text, Geo, Timestamp 필터)
  • 지리(geographic) 쿼리
  • 타임스탬프/날짜 필터링
  • AND/OR 논리가 있는 복잡한 필터 조합
  • 더 깔끔한 배열 기반 스키마 정의

RedisVectorStore는 다음에 사용하세요:

  • 이전 버전 호환이 필요한 기존 프로젝트
  • 고급 필터링 요구사항이 없는 단순 사용 사례

FluentRedisVectorStore 사용

FluentRedisVectorStore는 고급 메타데이터 필터링을 위한 현대적이고 타입 안전한 API를 제공해요.

FluentRedisVectorStore로 스키마 정의:

import { FluentRedisVectorStore } from "@langchain/redis";
import type { RedisVectorStoreConfig } from "@langchain/redis";
import { OpenAIEmbeddings } from "@langchain/openai";
import { createClient } from "redis";

const embeddings = new OpenAIEmbeddings({
  model: "text-embedding-3-small",
});

const client = createClient({
  url: process.env.REDIS_URL ?? "redis://localhost:6379",
});
await client.connect();

// Define custom schema for metadata fields using array format
const customSchema = [
  { name: "category", type: "tag" },
  { name: "price", type: "numeric", options: { sortable: true } },
  { name: "title", type: "text", options: { weight: 2.0 } },
  { name: "location", type: "geo" },
  { name: "created_at", type: "numeric", options: { sortable: true } },
  { name: "brand", type: "tag" },
  { name: "rating", type: "numeric" },
];

const vectorStore = await FluentRedisVectorStore.fromDocuments(
  documents,
  embeddings,
  {
    redisClient: client,
    indexName: "products",
    customSchema,
  }
);
**`customSchema`는 필수이며, 추론은 검증용일 뿐입니다:**

FluentRedisVectorStorecustomSchema를 요구해요. 문서로 인덱스를 만들 때 문서 메타데이터에서 스키마를 추론하고, 추론된 스키마가 사용자 customSchema와 다르면 경고를 기록해요.

비교에 사용되는 추론 규칙:

  • "lon,lat" 형식의 문자열 (예: "-122.4194,37.7749") → GEO 필드
  • 숫자 또는 Date 객체 → NUMERIC 필드
  • 모든 타입의 배열 → TAG 필드
  • 기타 모든 타입 → TEXT 필드

원하는 필드 타입(예: 문자열의 TEXT vs TAG)과 sortable, weight, caseSensitive 같은 옵션을 제어할 수 있도록 스키마를 명시적으로 정의하세요.

RedisVectorStore (레거시) 사용

원래 RedisVectorStore는 객체 기반 스키마 형식을 사용해요:

import { RedisVectorStore } from "@langchain/redis";
import { SchemaFieldTypes } from "redis";

// Define custom schema for metadata fields using object format
const customSchema = {
  userId: {
    type: SchemaFieldTypes.TEXT,
    required: true,
    SORTABLE: true,
  },
  category: {
    type: SchemaFieldTypes.TAG,
    SORTABLE: true,
    SEPARATOR: ",",
  },
  score: {
    type: SchemaFieldTypes.NUMERIC,
    SORTABLE: true,
  },
  tags: {
    type: SchemaFieldTypes.TAG,
    SEPARATOR: ",",
    CASESENSITIVE: true,
  },
  description: {
    type: SchemaFieldTypes.TEXT,
    NOSTEM: true,
    WEIGHT: 2.0,
  },
};

const vectorStoreWithSchema = new RedisVectorStore(embeddings, {
  redisClient: client,
  indexName: "langchainjs-custom-schema",
  customSchema,
});

스키마 필드 유형 (Schema field types)

FluentRedisVectorStore는 네 가지 스키마 필드 유형을 지원해요:

  • TEXT: 선택적 형태소 분석(stemming), 가중치, 정렬이 있는 전체 텍스트 검색 필드
  • TAG: 정확 일치를 위한 범주형 필드, 여러 값과 커스텀 구분자 지원
  • NUMERIC: 범위 쿼리와 정렬을 지원하는 숫자 필드. 타임스탬프에 사용 (Unix epoch 초로 저장; Date 값은 자동 변환)
  • GEO: 위치 기반 쿼리를 위한 지리 좌표 필드 ([longitude, latitude]로 저장)

numeric 타임스탬프 필드에 대해 Timestamp() 필터 헬퍼를 사용하세요.

RedisVectorStore (레거시)는 세 가지 필드 유형을 지원해요:

  • TEXT: 전체 텍스트 검색 가능한 필드
  • TAG: 정확 일치를 위한 범주형 필드
  • NUMERIC: 범위 쿼리를 지원하는 숫자 필드

필드 구성 옵션 (Field configuration options)

FluentRedisVectorStore (배열 기반 스키마):

  • name: 필드 이름 (필수)
  • type: 필드 타입 - "text", "tag", "numeric", "geo" (필수)
  • options: 선택적 구성 객체:
    • sortable: 이 필드에 정렬 활성화 (boolean)
    • separator: TAG 필드의 여러 값 구분자 지정 (string, 기본: ",")
    • caseSensitive: TAG 필드의 대소문자 구분 일치 활성화 (boolean)
    • noStem: TEXT 필드의 형태소 분석 비활성화 (boolean)
    • weight: TEXT 필드의 검색 가중치 지정 (number, 기본: 1.0)

RedisVectorStore (객체 기반 스키마):

  • required: 메타데이터에 필드가 있어야 하는지 (기본: false)
  • SORTABLE: 이 필드에 정렬 활성화 (기본: undefined)
  • SEPARATOR: TAG 필드의 여러 값 구분자 (기본: ",")
  • CASESENSITIVE: TAG 필드의 대소문자 구분 일치 (Redis는 boolean이 아닌 true를 기대)
  • NOSTEM: TEXT 필드의 형태소 분석 비활성화 (Redis는 boolean이 아닌 true를 기대)
  • WEIGHT: TEXT 필드의 검색 가중치 (기본: 1.0)

스키마 검증으로 문서 추가 (Adding documents with schema validation)

RedisVectorStore 또는 FluentRedisVectorStore를 사용할 때, 인덱스가 생성되면 문서의 메타데이터가 문서 추가 시 제공된 커스텀 스키마와 비교돼요.

FluentRedisVectorStore (배열 기반 스키마):

정의한 스키마와 문서에서 추론된 메타데이터 필드 사이에 불일치가 있으면 콘솔에 경고 메시지가 기록돼요:

"The custom schema does not match the metadata schema inferred from the documents.
This is not necessarily an issue, but could indicate an invalid custom schema."

이 검증은 다음 같은 잠재적 문제를 조기에 발견하는 데 도움이 돼요:

  • 문서에 문자열 값이 있는데 필드를 numeric으로 정의
  • 문서가 "lon,lat" 문자열 형식을 사용하지 않는데 필드를 geo로 정의
  • 문서에 존재하지만 스키마에 없는 필드
  • 스키마 정의와 실제 데이터 사이의 타입 불일치

RedisVectorStore (객체 기반 스키마):

customSchema가 정의된 경우에만 검증하며, 스키마가 없으면 검증을 완전히 건너뜁니다. 검증은:

  • required: true로 표시된 필드가 없으면(undefined 또는 null) 오류 발생
  • 필드 타입이 스키마 타입과 일치하지 않으면 오류 발생 (예: NUMERIC 스키마 필드는 숫자 메타데이터 필드를 기대)
**스키마 검증 모범 사례:**
  1. 올바른 데이터 타입 사용: 문서 메타데이터가 스키마 필드 타입과 일치하는지 확인
  2. GEO 필드: 문자열 형식 "longitude,latitude" 사용 (예: "-122.4194,37.7749")
  3. TIMESTAMP 필드: Date 객체 또는 숫자(Unix 타임스탬프) 사용
  4. TAG 필드용 배열: 배열은 자동으로 TAG 필드로 추론됨
  5. 샘플 데이터로 테스트: 대량 인덱싱 전에 몇 개 문서로 스키마 검증

fluent API로 고급 필터링 (Advanced filtering with the fluent API)

**중요:** fluent 필터링 API(`Tag`, `Num`, `Text`, `Geo`, `Timestamp`, `Custom`)는 **`FluentRedisVectorStore`에서만 사용할 수 있어요**. 레거시 `RedisVectorStore`는 다른 필터링 방식을 사용해요.

FluentRedisVectorStore는 복잡한 메타데이터 필터를 구축하기 위한 강력한 fluent API를 제공해요. 이 API는 다양한 필드 유형과 논리 연산을 지원하는 타입 안전한 필터 구성을 제공해요.

필터 빌더 import:

import {
  FluentRedisVectorStore,
  Tag,
  Num,
  Text,
  Geo,
  Timestamp,
  Custom,
} from "@langchain/redis";

간단한 태그 필터링:

// Filter for electronics category
const electronicsFilter = Tag("category").eq("electronics");
const results = await vectorStore.similaritySearch(
  "high quality device",
  5,
  electronicsFilter
);

숫자 범위 필터링:

// Filter for products between $20-$500
const priceFilter = Num("price").between(20, 500);
const results = await vectorStore.similaritySearch(
  "quality product",
  5,
  priceFilter
);

// Other numeric operations
Num("price").eq(99.99);           // Exact match
Num("price").gt(50);              // Greater than
Num("price").gte(50);             // Greater than or equal
Num("price").lt(100);             // Less than
Num("price").lte(100);            // Less than or equal
Num("price").between(20, 100);   // Between (inclusive)

텍스트 검색 필터링:

// Search for titles containing "programming"
const textFilter = Text("title").wildcard("*programming*");
const results = await vectorStore.similaritySearch(
  "learning guide",
  5,
  textFilter
);

// Other text operations
Text("title").eq("exact title");           // Exact match
Text("description").match("guide");        // Text match
Text("title").wildcard("*JavaScript*");    // Wildcard search

지리 필터링:

// Find items within 50km of San Francisco
const geoFilter = Geo("location").within(-122.4194, 37.7749, 50, "km");
const results = await vectorStore.similaritySearch(
  "local products",
  5,
  geoFilter
);

// Geo coordinates are stored as [longitude, latitude]
const doc = {
  pageContent: "Product description",
  metadata: {
    location: [-122.4194, 37.7749], // [longitude, latitude]
  },
};

타임스탬프 필터링:

// Find items created after March 1, 2023
const timestampFilter = Timestamp("created_at").gt(new Date("2023-03-01"));
const results = await vectorStore.similaritySearch(
  "recent items",
  5,
  timestampFilter
);

// Note: Timestamps are stored as Unix epoch timestamps (numbers)
// Date objects are automatically converted during serialization
// and returned as numbers during deserialization
const createdDate = new Date((doc.metadata.created_at as number) * 1000);

AND를 사용한 복잡한 결합 필터링:

// Electronics under $400 in California
const complexFilter = Tag("category")
  .eq("electronics")
  .and(Num("price").lt(400))
  .and(Geo("location").within(-119.4179, 36.7783, 500, "km"));

const results = await vectorStore.similaritySearch(
  "affordable electronics",
  5,
  complexFilter
);

OR 필터링:

// Books OR items under $30
const orFilter = Tag("category").eq("books").or(Num("price").lt(30));
const results = await vectorStore.similaritySearch(
  "affordable items",
  5,
  orFilter
);

여러 태그 값:

// TechCorp OR ViewTech brands
const multiTagFilter = Tag("brand").eq(["TechCorp", "ViewTech"]);
const results = await vectorStore.similaritySearch(
  "branded products",
  5,
  multiTagFilter
);

부정 필터링 (Negation):

// NOT electronics
const negationFilter = Tag("category").ne("electronics");
const results = await vectorStore.similaritySearch(
  "non-electronic items",
  5,
  negationFilter
);

원시 RediSearch 문법을 사용한 커스텀 필터:

// Use raw RediSearch query syntax for advanced cases
const customFilter = Custom("(@category:{electronics} @price:[0 400])");
const results = await vectorStore.similaritySearch(
  "affordable tech",
  5,
  customFilter
);

FluentRedisVectorStore로 완전한 필터링 예제

FluentRedisVectorStore의 다양한 필터링 기능을 보여주는 종합적인 예제예요:

import { createClient } from "redis";
import { OpenAIEmbeddings } from "@langchain/openai";
import {
  FluentRedisVectorStore,
  Tag,
  Num,
  Text,
  Geo,
  Timestamp,
} from "@langchain/redis";
import { Document } from "@langchain/core/documents";

// Connect to Redis
const client = createClient({
  url: process.env.REDIS_URL ?? "redis://localhost:6379",
});
await client.connect();

// Sample documents with rich metadata
const docs = [
  new Document({
    metadata: {
      category: "electronics",
      price: 299.99,
      title: "Wireless Bluetooth Headphones",
      location: [-122.4194, 37.7749], // San Francisco
      created_at: new Date("2023-01-15"),
      brand: "TechCorp",
      rating: 4.5,
    },
    pageContent:
      "High-quality wireless Bluetooth headphones with noise cancellation",
  }),
  new Document({
    metadata: {
      category: "books",
      price: 24.99,
      title: "JavaScript Programming Guide",
      location: [-74.006, 40.7128], // New York
      created_at: new Date("2023-03-20"),
      author: "John Smith",
      pages: 450,
    },
    pageContent:
      "Comprehensive guide to modern JavaScript programming techniques",
  }),
];

// Create FluentRedisVectorStore with metadata schema
const vectorStore = await FluentRedisVectorStore.fromDocuments(
  docs,
  new OpenAIEmbeddings(),
  {
    redisClient: client,
    indexName: "advanced_products",
    customSchema: [
      { name: "category", type: "tag" },
      { name: "price", type: "numeric", options: { sortable: true } },
      { name: "title", type: "text", options: { weight: 2.0 } },
      { name: "location", type: "geo" },
      { name: "created_at", type: "numeric", options: { sortable: true } },
      { name: "brand", type: "tag" },
      { name: "author", type: "tag" },
      { name: "rating", type: "numeric" },
      { name: "pages", type: "numeric" },
    ],
  }
);

// Example: Complex filtering - Electronics under $400 near San Francisco
const complexFilter = Tag("category")
  .eq("electronics")
  .and(Num("price").lt(400))
  .and(Geo("location").within(-122.4194, 37.7749, 100, "km"));

const results = await vectorStore.similaritySearch(
  "affordable electronics",
  5,
  complexFilter
);

// Cleanup
await vectorStore.delete({ deleteAll: true });
await client.disconnect();

레거시 API로 고급 필터링 (Advanced filtering with the legacy API)

레거시 RedisVectorStoresimilaritySearchVectorWithScoreAndMetadata 메서드를 사용한 메타데이터 필터링을 제공해요:

// Search with TAG filtering
const tagFilterResults =
  await vectorStoreWithSchema.similaritySearchVectorWithScoreAndMetadata(
    await embeddings.embedQuery("programming tutorial"),
    3,
    {
      category: "programming", // Exact tag match
      tags: ["javascript", "frontend"], // Multiple tag OR search
    }
  );

console.log("Tag filter results:");
for (const [doc, score] of tagFilterResults) {
  console.log(`* [SIM=${score.toFixed(3)}] ${doc.pageContent}`);
  console.log(`  Metadata: ${JSON.stringify(doc.metadata)}`);
}
// Search with NUMERIC range filtering
const numericFilterResults =
  await vectorStoreWithSchema.similaritySearchVectorWithScoreAndMetadata(
    await embeddings.embedQuery("high quality content"),
    5,
    {
      score: { min: 90, max: 100 }, // Score between 90 and 100
      category: ["programming", "ai"], // Multiple categories
    }
  );

console.log("Numeric filter results:");
for (const [doc, score] of numericFilterResults) {
  console.log(`* [SIM=${score.toFixed(3)}] ${doc.pageContent}`);
  console.log(
    `  Score: ${doc.metadata.score}, Category: ${doc.metadata.category}`
  );
}
// Search with TEXT field filtering
const textFilterResults =
  await vectorStoreWithSchema.similaritySearchVectorWithScoreAndMetadata(
    await embeddings.embedQuery("development guide"),
    3,
    {
      description: "comprehensive guide", // Text search in description field
      score: { min: 85 }, // Minimum score of 85
    }
  );

console.log("Text filter results:");
for (const [doc, score] of textFilterResults) {
  console.log(`* [SIM=${score.toFixed(3)}] ${doc.pageContent}`);
  console.log(`  Description: ${doc.metadata.description}`);
}

숫자 범위 쿼리 옵션 (Numeric range query options)

숫자 필드에 대해 다양한 범위 쿼리를 지정할 수 있어요:

// Exact value match
{ score: 95 }

// Range with both min and max
{ score: { min: 80, max: 100 } }

// Only minimum value
{ score: { min: 90 } }

// Only maximum value
{ score: { max: 95 } }

성능 이점 (Performance benefits)

커스텀 스키마와 fluent 필터링 API를 사용하면 여러 성능 이점이 있어요:

  1. 인덱스된 메타데이터 필드: 개별 메타데이터 필드를 별도로 인덱싱해 벡터 검색 전에 빠른 사전 필터링 가능
  2. 타입 최적화 쿼리: 숫자·태그·지리·텍스트 필드는 최적화된 RediSearch 쿼리 구조 사용
  3. 벡터 비교 감소: 필터가 벡터 유사도 계산 전에 적용되어 계산 오버헤드 감소
  4. 더 나은 쿼리 계획: Redis가 필드 타입과 인덱스에 기반해 쿼리를 최적화
  5. 타입 안전성: fluent API가 필터 구축에 컴파일 타임 타입 검사 제공

이전 버전 호환성 (Backward compatibility)

RedisVectorStoreFluentRedisVectorStore 모두 현재 지원·유지관리되고 있어요. 그러나 RedisVectorStore는 레거시로 간주되며 향후 주요 릴리스에서 deprecate될 수 있어요. RedisVectorStore를 사용하는 기존 코드는 변경 없이 계속 작동할 거예요.

마이그레이션 고려 사항:

  • customSchema 구성 키를 유지하되 객체 기반 형식에서 { name, type, options } 필드 배열로 전환
  • 객체 또는 문자열 필터를 fluent 필터 표현식(Tag, Num, Text, Geo, Timestamp, Custom)으로 교체
  • GEO 스키마 필드와 Timestamp() 필터 헬퍼는 FluentRedisVectorStore에서만 사용 가능
  • 메타데이터 저장 방식이 다름: FluentRedisVectorStore는 메타데이터를 개별 필드로 인덱싱하며 레거시 JSON-blob 메타데이터와 호환되지 않음. FluentRedisVectorStore를 기존 레거시 인덱스에 연결하기보다 새 인덱스를 만들고 문서를 다시 수집해야 함

API reference

모든 기능과 구성에 대한 자세한 문서:

출처: 문서

본문

RedisVectorStoreFluentRedisVectorStore는 RediSearch를 사용하는 Redis용 벡터 스토어 통합이에요. @langchain/redis 패키지에서 createClient로 연결하고 인스턴스화해요. FluentRedisVectorStore는 타입 안전한 fluent 필터링 API(Tag·Num·Text·Geo·Timestamp·Custom)와 GEO·타임스탬프 필드, 배열 기반 customSchema를 제공하며, 레거시 RedisVectorStore는 객체 기반 스키마·similaritySearchVectorWithScoreAndMetadata를 제공해요. 문서 추가·삭제(deleteAll/ID), similaritySearch·similaritySearchWithScore·asRetriever()를 지원해요.

더 알아보기 (Learn more)