Skip to content

Commit c2cf6d0

Browse files
committed
fixes
1 parent 796d7d7 commit c2cf6d0

File tree

3 files changed

+134
-5
lines changed

3 files changed

+134
-5
lines changed

Makefile.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ script = '''
137137
138138
is_portable = eq ${1} "--portable"
139139
140-
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
140+
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama embed_openai embed_cohere embed_hugging_face embed_voyageai
141141
for target in ${targets}
142142
if is_portable
143-
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
143+
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}_portable.wasm
144144
else
145145
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}.wasm
146146
end
@@ -153,10 +153,10 @@ script = '''
153153
154154
is_portable = eq ${1} "--portable"
155155
156-
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
156+
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama embed_openai embed_cohere embed_hugging_face embed_voyageai
157157
for target in ${targets}
158158
if is_portable
159-
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm
159+
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}_portable.wasm
160160
else
161161
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}.wasm
162162
end

embed/Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ dependencies = ["wit-update"]
124124

125125
script_runner = "@duckscript"
126126
script = """
127-
modules = array embed embed-openai embed-cohere embed-hugging-face embed-voyageai
127+
modules = array embed openai cohere hugging-face voyageai
128128
129129
for module in ${modules}
130130
rm -r ${module}/wit/deps
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package golem:embed@1.0.0;
2+
3+
interface embed {
4+
// --- Enums ---
5+
6+
enum task-type {
7+
retrieval-query,
8+
retrieval-document,
9+
semantic-similarity,
10+
classification,
11+
clustering,
12+
question-answering,
13+
fact-verification,
14+
code-retrieval,
15+
}
16+
17+
enum output-format {
18+
float-array,
19+
binary,
20+
base64,
21+
}
22+
23+
enum output-dtype {
24+
float-array,
25+
int8,
26+
uint8,
27+
binary,
28+
ubinary,
29+
}
30+
31+
enum error-code {
32+
invalid-request,
33+
model-not-found,
34+
unsupported,
35+
authentication-failed,
36+
provider-error,
37+
rate-limit-exceeded,
38+
internal-error,
39+
unknown,
40+
}
41+
42+
// --- Content ---
43+
44+
record image-url {
45+
url: string,
46+
}
47+
48+
variant content-part {
49+
text(string),
50+
image(image-url),
51+
}
52+
53+
// --- Configuration ---
54+
55+
record kv {
56+
key: string,
57+
value: string,
58+
}
59+
60+
record config {
61+
model: option<string>,
62+
task-type: option<task-type>,
63+
dimensions: option<u32>,
64+
truncation: option<bool>,
65+
output-format: option<output-format>,
66+
output-dtype: option<output-dtype>,
67+
user: option<string>,
68+
provider-options: list<kv>,
69+
}
70+
71+
// --- Embedding Response ---
72+
73+
record usage {
74+
input-tokens: option<u32>,
75+
total-tokens: option<u32>,
76+
}
77+
78+
record embedding {
79+
index: u32,
80+
vector: list<f32>,
81+
}
82+
83+
record embedding-response {
84+
embeddings: list<embedding>,
85+
usage: option<usage>,
86+
model: string,
87+
provider-metadata-json: option<string>,
88+
}
89+
90+
// --- Rerank Response ---
91+
92+
record rerank-result {
93+
index: u32,
94+
relevance-score: f32,
95+
document: option<string>,
96+
}
97+
98+
record rerank-response {
99+
results: list<rerank-result>,
100+
usage: option<usage>,
101+
model: string,
102+
provider-metadata-json: option<string>,
103+
}
104+
105+
// --- Error Handling ---
106+
107+
record error {
108+
code: error-code,
109+
message: string,
110+
provider-error-json: option<string>,
111+
}
112+
113+
// --- Core Functions ---
114+
115+
generate: func(
116+
inputs: list<content-part>,
117+
config: config
118+
) -> result<embedding-response, error>;
119+
120+
rerank: func(
121+
query: string,
122+
documents: list<string>,
123+
config: config
124+
) -> result<rerank-response, error>;
125+
}
126+
127+
world embed-library {
128+
export embed;
129+
}

0 commit comments

Comments
 (0)