Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@azure/search-documents ts bug #33135

Open
3 of 6 tasks
FrancescoSaverioZuppichini opened this issue Feb 19, 2025 · 1 comment
Open
3 of 6 tasks

@azure/search-documents ts bug #33135

FrancescoSaverioZuppichini opened this issue Feb 19, 2025 · 1 comment
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Search

Comments

@FrancescoSaverioZuppichini
  • Package Name: @azure/search-documents
  • Package Version: 12.1.0
  • Operating system: Mac os
  • nodejs
    • version: 22
  • browser
    • name/version:
  • typescript
    • version: ^5
  • Is the bug related to documentation in

Describe the bug
Trying to use the documentation but I have ts errors

To Reproduce
Steps to reproduce the behavior:

  1. Install the package
import {
  AzureKeyCredential,
  SearchClient,
  SearchIndexClient,
} from "@azure/search-documents"

const indexClient = new SearchIndexClient(
  "asd",
  new AzureKeyCredential("asd")
)
async function main() {
  const result = await indexClient.createIndex({
    name: "documents",
    fields: [
      {
        type: "Edm.String",
        name: "id",
        key: true,
      },
      {
        type: "Edm.String",
        name: "segmentId",
      },
      {
        type: "Edm.String",
        name: "content",
        searchable: true,
      },
      {
        name: "vector",
        type: "Collection(Edm.Single)",
        searchable: true,
        retrievable: false,
        stored: false,
        dimensions: 1536,
        vectorSearchProfile: "vector-profile-1",
      },
      {
        type: "Edm.ComplexType",
        name: "metadata",
        fields: [
          {
            type: "Collection(Edm.String)",
            name: "tags",
            searchable: true,
          },
        ],
      },
      {
        type: "Edm.Int32",
        name: "hiddenWeight",
        hidden: true,
      },
    ],
    vectorSearch: {
      compressions: [
        {
          name: "scalar-quantization",
          kind: "scalarQuantization",
          rerankWithOriginalVectors: true,
          defaultOversampling: 10.0,
          scalarQuantizationParameters: {
            quantizedDataType: "int8",
          },
        },
        {
          name: "binary-quantization",
          kind: "binaryQuantization",
          rerankWithOriginalVectors: true,
          defaultOversampling: 10.0,
        },
      ],
      algorithms: [
        {
          name: "hnsw-1",
          kind: "hnsw",
          hnswParameters: {
            m: 4,
            efConstruction: 400,
            efSearch: 500,
            metric: "cosine",
          },
        },
        {
          name: "hnsw-2",
          kind: "hnsw",
          hnswParameters: {
            m: 8,
            efConstruction: 800,
            efSearch: 800,
            metric: "hamming",
          },
        },
        {
          name: "eknn",
          kind: "exhaustiveKnn",
          exhaustiveKnnParameters: {
            metric: "euclidean",
          },
        },
      ],
      profiles: [
        {
          name: "vector-profile-hnsw-scalar",
          compression: "scalar-quantization",
          algorithm: "hnsw-1",
        },
      ],
    },
  })

  console.log(result)
}

main()

Expected behavior
The code copied and pasted from the doc should not have ts errors

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Thanks a lot

Image Image
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 19, 2025
@jeremymeng jeremymeng added Client This issue points to a problem in the data-plane of the library. Search labels Feb 19, 2025
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 19, 2025
@FrancescoSaverioZuppichini
Copy link
Author

btw following vscode hints when typing, this works

{      name: "documents",
      fields: [
        {
          type: "Edm.String",
          name: "id",
          key: true,
        },
        {
          type: "Edm.String",
          name: "segmentId",
        },
        {
          type: "Edm.String",
          name: "content",
          searchable: true,
        },
        {
          name: "vector",
          type: "Collection(Edm.Single)",
          searchable: true,
          stored: false,
          vectorSearchDimensions: 1536,
          vectorSearchProfileName: "vector-profile-hnsw-scalar",
        },
        {
          type: "Edm.ComplexType",
          name: "metadata",
          fields: [
            {
              type: "Collection(Edm.String)",
              name: "tags",
              searchable: true,
            },
          ],
        },
        {
          type: "Edm.Int32",
          name: "hiddenWeight",
          hidden: true,
        },
      ],
      vectorSearch: {
        compressions: [
          {
            compressionName: "scalar-quantization",
            kind: "scalarQuantization",
            rerankWithOriginalVectors: true,
            defaultOversampling: 10.0,
            parameters: {
              quantizedDataType: "int8",
            },
          },
        ],
        algorithms: [
          {
            name: "hnsw",
            kind: "hnsw",
            parameters: {
              m: 4,
              efConstruction: 400,
              efSearch: 500,
              metric: "cosine",
            },
          },
        ],
        profiles: [
          {
            name: "vector-profile-hnsw-scalar",
            compressionName: "scalar-quantization",
            algorithmConfigurationName: "hnsw",
          },
        ],
      },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Search
Projects
None yet
Development

No branches or pull requests

3 participants