initial commit: slides ready + upgraded
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Qdrant - Búsqueda
|
||||
|
||||
```typescript
|
||||
import { QdrantVectorStore } from "@langchain/qdrant";
|
||||
import { OpenAIEmbeddings } from "@langchain/openai";
|
||||
|
||||
// Conectar a colección existente
|
||||
const vectorStore = await QdrantVectorStore.fromExistingCollection(
|
||||
new OpenAIEmbeddings(),
|
||||
{
|
||||
url: "http://localhost:6333",
|
||||
collectionName: "langchain_docs",
|
||||
}
|
||||
);
|
||||
|
||||
// Búsqueda por similitud
|
||||
const results = await vectorStore.similaritySearch(
|
||||
"¿Qué es RAG?",
|
||||
3 // top 3 resultados
|
||||
);
|
||||
|
||||
results.forEach((doc, i) => {
|
||||
console.log(`${i + 1}. ${doc.pageContent}`);
|
||||
console.log(` Metadata:`, doc.metadata);
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user