class AzionVectorStoreExample usage:
// Initialize the vector store
const vectorStore = new AzionVectorStore(embeddings, {
dbName: "mydb",
tableName: "documents"
});
// Setup database with hybrid search and metadata columns
await vectorStore.setupDatabase({
columns: ["topic", "language"],
mode: "hybrid"
});
// OR: Initialize using the static create method
const vectorStore = await AzionVectorStore.initialize(embeddings, {
dbName: "mydb",
tableName: "documents"
}, {
columns: ["topic", "language"],
mode: "hybrid"
});
By default, the columns are not expanded, meaning that the metadata is stored in a single column:
// Setup database with hybrid search and metadata columns
await vectorStore.setupDatabase({
columns: ["*"],
mode: "hybrid"
});
// Add documents to the vector store
await vectorStore.addDocuments([
new Document({
pageContent: "Australia is known for its unique wildlife",
metadata: { topic: "nature", language: "en" }
})
]);
// Perform similarity search
const results = await vectorStore.similaritySearch(
"coral reefs in Australia",
2, // Return top 2 results
{ filter: [{ operator: "=", column: "topic", string: "biology" }] } // Optional AzionFilter
);
// Perform full text search
const ftResults = await vectorStore.fullTextSearch(
"Sydney Opera House",
1, // Return top result
{ filter: [{ operator: "=", column: "language", string: "en" }] } // Optional AzionFilter
);