Skip to content

Commit

Permalink
remove all ref to openai
Browse files Browse the repository at this point in the history
  • Loading branch information
jairad26 committed Sep 6, 2024
1 parent be5509d commit c86d719
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
10 changes: 0 additions & 10 deletions functions/assembly/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { collections } from "@hypermode/functions-as";
import { starterEmojis } from "./emojis";
import { models } from "@hypermode/functions-as";
import { OpenAIEmbeddingsModel } from "@hypermode/models-as/models/openai/embeddings";
import { EmbeddingsModel } from "@hypermode/models-as/models/experimental/embeddings";

import {
Expand All @@ -13,20 +12,11 @@ import {
import { JSON } from "json-as";

// These names should match the ones defined in the hypermode.json manifest file.
const openAImbeddingModelName: string = "embeddings";
const miniLMEmbeddingsModelName: string = "minilm";
const generationModelName: string = "text-generator";
const emojis: string = "emojis";
const searchMethod: string = "searchMethod1";

// This function takes input text and returns the vector embedding for that text.
export function openAIEmbed(text: string[]): f32[][] {
const model = models.getModel<OpenAIEmbeddingsModel>(openAImbeddingModelName);
const input = model.createInput(text);
const output = model.invoke(input);
return output.data.map<f32[]>((d) => d.embedding);
}

export function miniLMEmbed(text: string[]): f32[][] {
const model = models.getModel<EmbeddingsModel>(miniLMEmbeddingsModelName);
const input = model.createInput(text);
Expand Down
14 changes: 1 addition & 13 deletions hypermode.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"$schema": "https://manifest.hypermode.com/hypermode.json",
"models": {
"embeddings": {
"sourceModel": "text-embedding-3-large",
"host": "openai",
"path": "v1/embeddings"
},
"minilm": {
"sourceModel": "sentence-transformers/all-MiniLM-L6-v2",
"provider": "hugging-face",
Expand All @@ -18,14 +13,7 @@
}
},

"hosts": {
"openai": {
"baseUrl": "https://api.openai.com/",
"headers": {
"Authorization": "Bearer {{API_KEY}}"
}
}
},
"hosts": {},
"collections": {
"emojis": {
"searchMethods": {
Expand Down

0 comments on commit c86d719

Please sign in to comment.