Skip to content

Implement models API #344

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

Merged
merged 8 commits into from
May 9, 2025
Merged

Conversation

austin-denoble
Copy link
Contributor

@austin-denoble austin-denoble commented May 9, 2025

Problem

Inference has new APIs which were made available in 2025-04. These allow for listing and describing available models hosted by Pinecone.

Solution

  • I took the liberty to refactor the Inference class to better align with other classes used in a similar way such as Index and Pinecone. I broke out all inference actions into individual files / functions: embed.ts and rerank.ts. I think a lot of this was implemented rather quickly initially, so I've done a bunch of cleanup while I was in here adding new methods.
  • Add new getModel.ts and listModels.ts files/functions. These are called and documented inside Inference.
  • Rework unit tests for embed and rerank. Basically just standardized to how we do mocking / testing elsewhere. They were a bit awkward.
  • Add unit tests for getModel, listModels, along with an integration test file.
  • Update README to add examples working with models.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

CI - external test, unit tests, integration tests

To test this you can pull this branch down, and run the repl locally:

from pinecone-ts-client root:

export PINECONE_API_KEY=<here>
npm run repl
await init()

await client.inference.listModels()
await client.inference.getModel('multilingual-e5-large')

@austin-denoble austin-denoble marked this pull request as ready for review May 9, 2025 22:20
@austin-denoble austin-denoble merged commit b432d20 into 2025-04 May 9, 2025
26 checks passed
@austin-denoble austin-denoble deleted the adenoble/implement-models-api branch May 9, 2025 22:57
@austin-denoble austin-denoble mentioned this pull request May 9, 2025
7 tasks
austin-denoble added a commit that referenced this pull request May 9, 2025
## Problem
Inference has new APIs which were made available in `2025-04`. These
allow for listing and describing available models hosted by Pinecone.

## Solution

- I took the liberty to refactor the `Inference` class to better align
with other classes used in a similar way such as `Index` and `Pinecone`.
I broke out all inference actions into individual files / functions:
`embed.ts` and `rerank.ts`. I think a lot of this was implemented rather
quickly initially, so I've done a bunch of cleanup while I was in here
adding new methods.
- Add new `getModel.ts` and `listModels.ts` files/functions. These are
called and documented inside `Inference`.
- Rework unit tests for `embed` and `rerank`. Basically just
standardized to how we do mocking / testing elsewhere. They were a bit
awkward.
- Add unit tests for `getModel`, `listModels`, along with an integration
test file.
- Update README to add examples working with models.

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)

## Test Plan
CI - external test, unit tests, integration tests

To test this you can pull this branch down, and run the repl locally:

from `pinecone-ts-client` root:
```
export PINECONE_API_KEY=<here>
npm run repl
await init()

await client.inference.listModels()
await client.inference.getModel('multilingual-e5-large')
```

---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1209828518477622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant