Skip to content

Commit

Permalink
[Search] Prepare 2023 August Release (Azure#26772)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgetu authored Aug 10, 2023
1 parent e158c3f commit fc40831
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 469 deletions.
6 changes: 1 addition & 5 deletions sdk/search/search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 12.0.0-beta.3 (Unreleased)
## 12.0.0-beta.3 (2023-08-10)

### Features Added

Expand All @@ -11,10 +11,6 @@
- Change vector option `SearchOptions.vector` to array of vectors option
`SearchOptions.vectors`. [#26765](https://github.com/Azure/azure-sdk-for-js/pull/26765)

### Bugs Fixed

### Other Changes

## 12.0.0-beta.2 (2023-07-11)

### Features Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ async function createIndex(client, name) {
},
{
type: "Collection(Edm.Single)",
name: "descriptionVector",
name: "descriptionVectorEn",
searchable: true,
vectorSearchDimensions: 1536,
vectorSearchConfiguration: "vector-search-configuration",
},
{
type: "Collection(Edm.Single)",
name: "descriptionVectorFr",
searchable: true,
vectorSearchDimensions: 1536,
vectorSearchConfiguration: "vector-search-configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
const { createIndex, WAIT_TIME, delay } = require("./setup");

const dotenv = require("dotenv");
const { fancyStayVector, luxuryQueryVector } = require("./vectors");
const { fancyStayEnVector, fancyStayFrVector, luxuryQueryVector } = require("./vectors");
dotenv.config();

/**
Expand Down Expand Up @@ -61,7 +61,9 @@ async function main() {
longitude: -122.131577,
latitude: 47.678581,
}),
descriptionVector: fancyStayVector,
// Embeddings of the description text above
descriptionVectorEn: fancyStayEnVector,
descriptionVectorFr: fancyStayFrVector,
},
]);

Expand All @@ -74,11 +76,20 @@ async function main() {
await delay(WAIT_TIME);

const searchResults = await searchClient.search("*", {
vector: {
fields: ["descriptionVector"],
kNearestNeighborsCount: 3,
value: luxuryQueryVector,
},
vectors: [
{
fields: ["descriptionVectorEn"],
kNearestNeighborsCount: 3,
// An embedding of the query "What are the most luxurious hotels?"
value: luxuryQueryVector,
},
// Multi-vector search is supported
{
fields: ["descriptionVectorFr"],
kNearestNeighborsCount: 3,
value: luxuryQueryVector,
},
],
});

for await (const result of searchResults.results) {
Expand Down
674 changes: 450 additions & 224 deletions sdk/search/search-documents/samples/v12-beta/javascript/vectors.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export interface Hotel {
hotelId?: string;
hotelName?: string | null;
description?: string | null;
descriptionVector?: number[] | null;
descriptionVectorEn?: number[] | null;
descriptionVectorFr?: number[] | null;
descriptionFr?: string | null;
category?: string | null;
tags?: string[] | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ export async function createIndex(client: SearchIndexClient, name: string): Prom
},
{
type: "Collection(Edm.Single)",
name: "descriptionVector",
name: "descriptionVectorEn",
searchable: true,
vectorSearchDimensions: 1536,
vectorSearchConfiguration: "vector-search-configuration",
},
{
type: "Collection(Edm.Single)",
name: "descriptionVectorFr",
searchable: true,
vectorSearchDimensions: 1536,
vectorSearchConfiguration: "vector-search-configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { createIndex, WAIT_TIME, delay } from "./setup";
import { Hotel } from "./interfaces";

import * as dotenv from "dotenv";
import { fancyStayVector, luxuryQueryVector } from "./vectors";
import { fancyStayEnVector, fancyStayFrVector, luxuryQueryVector } from "./vectors";
dotenv.config();

/**
Expand Down Expand Up @@ -66,7 +66,9 @@ async function main() {
longitude: -122.131577,
latitude: 47.678581,
}),
descriptionVector: fancyStayVector,
// Embeddings of the description text above
descriptionVectorEn: fancyStayEnVector,
descriptionVectorFr: fancyStayFrVector,
},
]);

Expand All @@ -79,11 +81,20 @@ async function main() {
await delay(WAIT_TIME);

const searchResults = await searchClient.search("*", {
vector: {
fields: ["descriptionVector"],
kNearestNeighborsCount: 3,
value: luxuryQueryVector,
},
vectors: [
{
fields: ["descriptionVectorEn"],
kNearestNeighborsCount: 3,
// An embedding of the query "What are the most luxurious hotels?"
value: luxuryQueryVector,
},
// Multi-vector search is supported
{
fields: ["descriptionVectorFr"],
kNearestNeighborsCount: 3,
value: luxuryQueryVector,
},
],
});

for await (const result of searchResults.results) {
Expand Down
Loading

0 comments on commit fc40831

Please sign in to comment.