Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Dec 25, 2023
1 parent 41d47cf commit dbb7242
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions provider/docs/src/corpus/search/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import * as onnxWeb from 'onnxruntime-web'
import { memo, noopCache, type CorpusCache } from '../cache/cache'
import { type CorpusSearchResult, type StoredCorpus } from '../corpus'

// Force use of wasm backend for parity between Node.js and web.
//
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
env.onnx = onnxWeb.env
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
;(env as any).onnx.wasm.numThreads = 1
if (process.env.FORCE_WASM) {
// Force use of wasm backend for parity between Node.js and web.
//
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
env.onnx = onnxWeb.env
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
;(env as any).onnx.wasm.numThreads = 1
}

export async function embeddingsSearch(
storage: StoredCorpus,
Expand Down

0 comments on commit dbb7242

Please sign in to comment.