Qdrant에서 MixedBread 사용하기
Qdrant에서 MixedBread 사용하기 (mixedbread)
MixedBread는 여러 도메인에 걸쳐 임베딩을 제공하는 독특한 프로바이더예요. Qdrant와 함께 쓰면 다양한 검색 작업에 활용할 수 있는 만능형 모델인데요, 차세대 검색 엔진이든 RAG(Retrieval Augmented Generation) 시스템이든, 기존 검색 솔루션을 개선하든, 검색을 더 똑똑하고 빠르고 관련성 높게 만드는 모델과 도구를 만들고 있어요.
설치
필요한 패키지는 pip 한 줄로 설치할 수 있어요.
pip install mixedbread
통합 예제
MixedBread의 API로 임베딩을 얻어 Qdrant 컬렉션에 저장하는 예제를 볼게요.
import qdrant_client
from qdrant_client.models import Batch
from mixedbread import MixedBreadModel
# Initialize MixedBread model
model = MixedBreadModel("mixedbread-variant")
# Generate embeddings
text = "MixedBread provides versatile embeddings for various domains."
embeddings = model.embed(text)
# Initialize Qdrant client
qdrant_client = qdrant_client.QdrantClient(host="localhost", port=6333)
# Upsert the embedding into Qdrant
qdrant_client.upsert(
collection_name="VersatileEmbeddings",
points=Batch(
ids=[1],
vectors=[embeddings],
)
)
흐름을 정리하면 이래요. 먼저 MixedBreadModel("mixedbread-variant")로 모델을 초기화하고, model.embed(text)로 텍스트를 벡터로 바꿔요. 그다음 QdrantClient로 로컬 Qdrant에 접속하고, upsert로 Batch 단위의 임베딩을 컬렉션에 넣어요. 모델 이름("mixedbread-variant")은 실제 배포하려는 MixedBread 모델에 맞게 바꾸면 돼요.
더 알아보기 (Learn more)
- MixedBread 공식 문서 (확인 필요: 정확한 문서 링크는 소스에서 확인해요)
- Qdrant 임베딩 통합 문서