Spaces:
Running
Running
Mishig
commited on
Commit
•
41f8b74
1
Parent(s):
26e028a
Mv embeddingEndpoints.ts (#688)
Browse files* Mv embeddingEndpoints.ts
* relative import
- src/lib/{types/EmbeddingEndpoints.ts → server/embeddingEndpoints/embeddingEndpoints.ts} +2 -2
- src/lib/server/embeddingEndpoints/tei/embeddingEndpoints.ts +1 -1
- src/lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints.ts +1 -1
- src/lib/server/embeddingModels.ts +1 -1
- src/lib/server/sentenceSimilarity.ts +1 -1
src/lib/{types/EmbeddingEndpoints.ts → server/embeddingEndpoints/embeddingEndpoints.ts}
RENAMED
@@ -2,11 +2,11 @@ import { z } from "zod";
|
|
2 |
import {
|
3 |
embeddingEndpointTei,
|
4 |
embeddingEndpointTeiParametersSchema,
|
5 |
-
} from "
|
6 |
import {
|
7 |
embeddingEndpointTransformersJS,
|
8 |
embeddingEndpointTransformersJSParametersSchema,
|
9 |
-
} from "
|
10 |
|
11 |
// parameters passed when generating text
|
12 |
interface EmbeddingEndpointParameters {
|
|
|
2 |
import {
|
3 |
embeddingEndpointTei,
|
4 |
embeddingEndpointTeiParametersSchema,
|
5 |
+
} from "./tei/embeddingEndpoints";
|
6 |
import {
|
7 |
embeddingEndpointTransformersJS,
|
8 |
embeddingEndpointTransformersJSParametersSchema,
|
9 |
+
} from "./transformersjs/embeddingEndpoints";
|
10 |
|
11 |
// parameters passed when generating text
|
12 |
interface EmbeddingEndpointParameters {
|
src/lib/server/embeddingEndpoints/tei/embeddingEndpoints.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { z } from "zod";
|
2 |
-
import type { EmbeddingEndpoint, Embedding } from "
|
3 |
import { chunk } from "$lib/utils/chunk";
|
4 |
|
5 |
export const embeddingEndpointTeiParametersSchema = z.object({
|
|
|
1 |
import { z } from "zod";
|
2 |
+
import type { EmbeddingEndpoint, Embedding } from "../embeddingEndpoints";
|
3 |
import { chunk } from "$lib/utils/chunk";
|
4 |
|
5 |
export const embeddingEndpointTeiParametersSchema = z.object({
|
src/lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { z } from "zod";
|
2 |
-
import type { EmbeddingEndpoint } from "
|
3 |
import type { Tensor, Pipeline } from "@xenova/transformers";
|
4 |
import { pipeline } from "@xenova/transformers";
|
5 |
|
|
|
1 |
import { z } from "zod";
|
2 |
+
import type { EmbeddingEndpoint } from "../embeddingEndpoints";
|
3 |
import type { Tensor, Pipeline } from "@xenova/transformers";
|
4 |
import { pipeline } from "@xenova/transformers";
|
5 |
|
src/lib/server/embeddingModels.ts
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6 |
embeddingEndpoints,
|
7 |
embeddingEndpointSchema,
|
8 |
type EmbeddingEndpoint,
|
9 |
-
} from "$lib/
|
10 |
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints";
|
11 |
|
12 |
const modelConfig = z.object({
|
|
|
6 |
embeddingEndpoints,
|
7 |
embeddingEndpointSchema,
|
8 |
type EmbeddingEndpoint,
|
9 |
+
} from "$lib/server/embeddingEndpoints/embeddingEndpoints";
|
10 |
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints";
|
11 |
|
12 |
const modelConfig = z.object({
|
src/lib/server/sentenceSimilarity.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import { dot } from "@xenova/transformers";
|
2 |
import type { EmbeddingBackendModel } from "$lib/server/embeddingModels";
|
3 |
-
import type { Embedding } from "$lib/
|
4 |
|
5 |
// see here: https://github.com/nmslib/hnswlib/blob/359b2ba87358224963986f709e593d799064ace6/README.md?plain=1#L34
|
6 |
function innerProduct(embeddingA: Embedding, embeddingB: Embedding) {
|
|
|
1 |
import { dot } from "@xenova/transformers";
|
2 |
import type { EmbeddingBackendModel } from "$lib/server/embeddingModels";
|
3 |
+
import type { Embedding } from "$lib/server/embeddingEndpoints/embeddingEndpoints";
|
4 |
|
5 |
// see here: https://github.com/nmslib/hnswlib/blob/359b2ba87358224963986f709e593d799064ace6/README.md?plain=1#L34
|
6 |
function innerProduct(embeddingA: Embedding, embeddingB: Embedding) {
|