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

[Feature] Export ListResponse type #209

Closed
2 tasks done
MikeCarbone opened this issue Mar 24, 2024 · 2 comments
Closed
2 tasks done

[Feature] Export ListResponse type #209

MikeCarbone opened this issue Mar 24, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@MikeCarbone
Copy link

MikeCarbone commented Mar 24, 2024

Is this your first time submitting a feature request?

  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing functionality

Describe the feature

When incorporating the delete function using the new serverless API, I needed access to the ListResponse type for this function, which will recursively delete all vectors related to a source document:

async function deletePineconePage(page: ListResponse) {
  if (page.vectors) {
    const pageVectorIds = page.vectors.map((vector) => vector.id);
    await index.deleteMany(pageVectorIds);
    if (page?.pagination?.next) {
      const nextPage = await index.listPaginated({
        prefix: `source_${sourceId}#`,
        paginationToken: page.pagination.next,
      });
      return await deletePineconePage(nextPage);
    }
  }
}
const initialPage = await index.listPaginated({
  prefix: `source_${sourceId}#`,
});
await deletePineconePage(initialPage);

Describe alternatives you've considered

Unfortunately, that ListResponse type is not exported from the main package. Instead I had to import the type from the build:

import type { ListResponse } from "@pinecone-database/pinecone/dist/pinecone-generated-ts-fetch";

Who will this benefit?

Anyone trying to access the type after using the new index.listPaginated option

Are you interested in contributing this feature?

No

Anything else?

No response

@MikeCarbone MikeCarbone added the enhancement New feature or request label Mar 24, 2024
austin-denoble added a commit that referenced this issue Mar 25, 2024
…stOptions` (#210)

## Problem
We're not exporting the generated `ListResponse` type from the OpenAPI
core. This is limiting for consumers when working with the client:
#209

## Solution
- Export `ListResponse` from `pinecone-generated-ts-fetch`.
- Add docstring for `ListOptions` type.

## Type of Change
- [X] New feature (non-breaking change which adds functionality)
- [X] Non-code change (docs, etc)

## Test Plan
CI unit + integration tests
@austin-denoble
Copy link
Contributor

Thank you for flagging, this interface should have been exported from the top level of the package. v2.1.1 exports the interface. You can find details here: https://github.com/pinecone-io/pinecone-ts-client/releases/tag/v2.1.1

@MikeCarbone
Copy link
Author

Great! Thanks @austin-denoble !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants