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

[WIP] Bun support #145

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,32 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
jest_env: ['node', 'edge']
config: [
# { runner: 'npm', jest_env: 'node' },
# { runner: 'npm', jest_env: 'edge' },
{ runner: 'bun', jest_env: 'node', bunVersion: '1.0.4' },
{ runner: 'bun', jest_env: 'node', bunVersion: '1.0.5' },
{ runner: 'bun', jest_env: 'node', bunVersion: '1.0.6' },
{ runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' },
]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Setup bun
if: matrix.config.bunVersion
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.config.bunVersion }}
- name: Run tests
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
run: npm run test:integration:${{ matrix.jest_env }}
run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}

example-app-semantic-search:
name: 'Example app: semantic search'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"format": "prettier --write .",
"lint": "eslint src/ --ext .ts",
"repl": "npm run build && node utils/replInit.ts",
"test:integration:node": "TEST_ENV=node jest src/integration/ -c jest.config.integration-node.js --runInBand --bail",
"test:integration:node": "TEST_ENV=node jest src/integration/data/query.test.ts -c jest.config.integration-node.js --runInBand --bail",
"test:integration:edge": "TEST_ENV=edge jest src/integration/ -c jest.config.integration-edge.js --runInBand --bail",
"test:integration:cleanup": "npm run build && node utils/cleanupResources.ts",
"test:unit": "jest src/"
Expand Down
18 changes: 18 additions & 0 deletions src/integration/data/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,22 @@ describe('query', () => {
expect(results.matches).toBeDefined();
expect(results.matches?.length).toEqual(topK);
});

test('query with includeValues: true', async () => {
const recordsToUpsert = generateRecords(5, 3);
expect(recordsToUpsert).toHaveLength(3);

const queryVec = Array.from({ length: 5 }, () => Math.random());

await ns.upsert(recordsToUpsert);
const results = await ns.query({
vector: queryVec,
topK: 2,
includeValues: true,
includeMetadata: true,
});

expect(results.matches).toBeDefined();
expect(results.matches?.length).toEqual(2);
});
});
Loading