Skip to content

Commit

Permalink
Use JSON5 for embeddings (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin authored Jan 22, 2024
1 parent 1e4a456 commit 6e0b0ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/server/embeddingModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from "$lib/server/embeddingEndpoints/embeddingEndpoints";
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints";

import JSON5 from "json5";

const modelConfig = z.object({
/** Used as an identifier in DB */
id: z.string().optional(),
Expand Down Expand Up @@ -37,7 +39,7 @@ const rawEmbeddingModelJSON =
}
]`;

const embeddingModelsRaw = z.array(modelConfig).parse(JSON.parse(rawEmbeddingModelJSON));
const embeddingModelsRaw = z.array(modelConfig).parse(JSON5.parse(rawEmbeddingModelJSON));

const processEmbeddingModel = async (m: z.infer<typeof modelConfig>) => ({
...m,
Expand Down

0 comments on commit 6e0b0ea

Please sign in to comment.