Skip to content

Commit 8ce476d

Browse files
committed
create_index(wip) && added algolia delete_index, list_indexes
1 parent 150d7f7 commit 8ce476d

File tree

18 files changed

+1010
-153
lines changed

18 files changed

+1010
-153
lines changed

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77
"llm/grok",
88
"llm/ollama",
99
"llm/openai",
10-
"llm/openrouter", "search/search",
10+
"llm/openrouter", "search/search", "search/algolia",
1111
]
1212

1313
[profile.release]

Makefile.toml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ args = ["test"]
1313
[tasks.build]
1414
script_runner = "@duckscript"
1515
script = '''
16-
domains = array llm
16+
domains = array llm search
1717
1818
# if there is no domain passed run for every domain
1919
if is_empty ${1}
@@ -28,7 +28,7 @@ end
2828
[tasks.release-build]
2929
script_runner = "@duckscript"
3030
script = '''
31-
domains = array llm
31+
domains = array llm search
3232
3333
# if there is no domain passed run for every domain
3434
if is_empty ${1}
@@ -44,7 +44,7 @@ end
4444
script_runner = "@duckscript"
4545
script = '''
4646
#!/bin/bash
47-
domains = array llm
47+
domains = array llm search
4848
4949
# if there is no domain passed run for every domain
5050
if is_empty ${1}
@@ -60,7 +60,7 @@ end
6060
script_runner = "@duckscript"
6161
script = '''
6262
#!/bin/bash
63-
domains = array llm
63+
domains = array llm search
6464
6565
# if there is no domain passed run for every domain
6666
if is_empty ${1}
@@ -75,7 +75,7 @@ end
7575
[tasks.wit]
7676
script_runner = "@duckscript"
7777
script = '''
78-
domains = array llm
78+
domains = array llm search
7979
8080
# if there is no domain passed run for every domain
8181
if is_empty ${1}
@@ -91,7 +91,7 @@ end
9191
description = "Builds all test components with golem-cli"
9292
script_runner = "@duckscript"
9393
script = '''
94-
domains = array llm
94+
domains = array llm search
9595
9696
# if there is no domain passed run for every domain
9797
if is_empty ${1}
@@ -145,6 +145,17 @@ for target in ${targets}
145145
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}.wasm
146146
end
147147
end
148+
149+
150+
151+
targets = array search_algolia
152+
for target in ${targets}
153+
if is_portable
154+
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
155+
else
156+
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}.wasm
157+
end
158+
end
148159
'''
149160

150161
[tasks.copy-release-artifacts]
@@ -161,6 +172,17 @@ for target in ${targets}
161172
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}.wasm
162173
end
163174
end
175+
176+
177+
targets = array search_algolia
178+
for target in ${targets}
179+
if is_portable
180+
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm
181+
else
182+
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}.wasm
183+
end
184+
end
185+
164186
'''
165187

166188
# Maintenance tasks

search/Makefile.toml

Lines changed: 20 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -4,154 +4,45 @@ skip_core_tasks = true
44

55
[tasks.build]
66
run_task = { name = [
7-
"build-anthropic",
8-
"build-grok",
9-
"build-openai",
10-
"build-openrouter",
11-
"build-ollama",
7+
"build-algolia",
128
] }
139

1410
[tasks.build-portable]
1511
run_task = { name = [
16-
"build-anthropic-portable",
17-
"build-grok-portable",
18-
"build-openai-portable",
19-
"build-openrouter-portable",
20-
"build-ollama-portable",
12+
"build-algolia-portable",
2113
] }
2214

2315
[tasks.release-build]
2416
run_task = { name = [
25-
"release-build-anthropic",
26-
"release-build-grok",
27-
"release-build-openai",
28-
"release-build-openrouter",
29-
"release-build-ollama",
17+
"release-build-algolia",
3018
] }
3119

3220
[tasks.release-build-portable]
3321
run_task = { name = [
34-
"release-build-anthropic-portable",
35-
"release-build-grok-portable",
36-
"release-build-openai-portable",
37-
"release-build-openrouter-portable",
38-
"release-build-ollama-portable",
22+
"release-build-algolia-portable",
3923
] }
4024

41-
[tasks.build-ollama]
25+
[tasks.build-algolia]
4226
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
4327
command = "cargo-component"
44-
args = ["build", "-p", "golem-llm-ollama"]
28+
args = ["build", "-p", "golem-search-algolia"]
4529

4630

47-
[tasks.build-ollama-portable]
31+
[tasks.build-algolia-portable]
4832
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
4933
command = "cargo-component"
50-
args = ["build", "-p", "golem-llm-ollama", "--no-default-features"]
34+
args = ["build", "-p", "golem-search-algolia", "--no-default-features"]
5135

5236

53-
[tasks.build-anthropic]
37+
[tasks.release-build-algolia]
5438
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
5539
command = "cargo-component"
56-
args = ["build", "-p", "golem-llm-anthropic"]
40+
args = ["build", "-p", "golem-search-algolia", "--release"]
5741

58-
[tasks.build-anthropic-portable]
42+
[tasks.release-build-algolia-portable]
5943
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
6044
command = "cargo-component"
61-
args = ["build", "-p", "golem-llm-anthropic", "--no-default-features"]
62-
63-
[tasks.build-grok]
64-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
65-
command = "cargo-component"
66-
args = ["build", "-p", "golem-llm-grok"]
67-
68-
[tasks.build-grok-portable]
69-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
70-
command = "cargo-component"
71-
args = ["build", "-p", "golem-llm-grok", "--no-default-features"]
72-
73-
[tasks.build-openai]
74-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
75-
command = "cargo-component"
76-
args = ["build", "-p", "golem-llm-openai"]
77-
78-
[tasks.build-openai-portable]
79-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
80-
command = "cargo-component"
81-
args = ["build", "-p", "golem-llm-openai", "--no-default-features"]
82-
83-
[tasks.build-openrouter]
84-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
85-
command = "cargo-component"
86-
args = ["build", "-p", "golem-llm-openrouter"]
87-
88-
[tasks.build-openrouter-portable]
89-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
90-
command = "cargo-component"
91-
args = ["build", "-p", "golem-llm-openrouter", "--no-default-features"]
92-
93-
[tasks.release-build-ollama]
94-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
95-
command = "cargo-component"
96-
args = ["build", "-p", "golem-llm-ollama", "--release"]
97-
98-
[tasks.release-build-ollama-portable]
99-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
100-
command = "cargo-component"
101-
args = ["build", "-p", "golem-llm-ollama", "--release", "--no-default-features"]
102-
103-
104-
[tasks.release-build-anthropic]
105-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
106-
command = "cargo-component"
107-
args = ["build", "-p", "golem-llm-anthropic", "--release"]
108-
109-
[tasks.release-build-anthropic-portable]
110-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
111-
command = "cargo-component"
112-
args = [
113-
"build",
114-
"-p",
115-
"golem-llm-anthropic",
116-
"--release",
117-
"--no-default-features",
118-
]
119-
120-
[tasks.release-build-grok]
121-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
122-
command = "cargo-component"
123-
args = ["build", "-p", "golem-llm-grok", "--release"]
124-
125-
[tasks.release-build-grok-portable]
126-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
127-
command = "cargo-component"
128-
args = ["build", "-p", "golem-llm-grok", "--release", "--no-default-features"]
129-
130-
[tasks.release-build-openai]
131-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
132-
command = "cargo-component"
133-
args = ["build", "-p", "golem-llm-openai", "--release"]
134-
135-
[tasks.release-build-openai-portable]
136-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
137-
command = "cargo-component"
138-
args = ["build", "-p", "golem-llm-openai", "--release", "--no-default-features"]
139-
140-
[tasks.release-build-openrouter]
141-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
142-
command = "cargo-component"
143-
args = ["build", "-p", "golem-llm-openrouter", "--release"]
144-
145-
[tasks.release-build-openrouter-portable]
146-
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
147-
command = "cargo-component"
148-
args = [
149-
"build",
150-
"-p",
151-
"golem-llm-openrouter",
152-
"--release",
153-
"--no-default-features",
154-
]
45+
args = ["build", "-p", "golem-search-algolia", "--release", "--no-default-features"]
15546

15647
[tasks.wit-update]
15748
install_crate = { crate_name = "wit-deps-cli" }
@@ -163,22 +54,22 @@ dependencies = ["wit-update"]
16354

16455
script_runner = "@duckscript"
16556
script = """
166-
modules = array llm openai anthropic grok openrouter ollama
57+
modules = array search algolia
16758
16859
for module in ${modules}
16960
rm -r ${module}/wit/deps
170-
mkdir ${module}/wit/deps/golem-llm
171-
cp wit/golem-llm.wit ${module}/wit/deps/golem-llm/golem-llm.wit
61+
mkdir ${module}/wit/deps/golem-search
62+
cp wit/golem-search.wit ${module}/wit/deps/golem-search/golem-search.wit
17263
cp wit/deps/wasi:io ${module}/wit/deps
17364
174-
echo "Copied WIT for module llm::${module}"
65+
echo "Copied WIT for module search::${module}"
17566
end
17667
17768
# Copy WIT files for integration tests
17869
rm -r ../test/wit
179-
mkdir ../test/wit/deps/golem-llm
70+
mkdir ../test/wit/deps/golem-search
18071
mkdir ../test/wit/deps/io
181-
cp wit/golem-llm.wit ../test/wit/deps/golem-llm/golem-llm.wit
72+
cp wit/golem-search.wit ../test/wit/deps/golem-search/golem-search.wit
18273
cp wit/deps/wasi:io/error.wit ../test/wit/deps/io/error.wit
18374
cp wit/deps/wasi:io/poll.wit ../test/wit/deps/io/poll.wit
18475
cp wit/deps/wasi:io/streams.wit ../test/wit/deps/io/streams.wit
@@ -190,21 +81,13 @@ echo "Copied WIT for module test"
19081
[tasks.build-test-components]
19182
dependencies = ["build"]
19283
install_crate = "cargo-binstall"
193-
description = "Builds llm test components with golem-cli"
84+
description = "Builds search test components with golem-cli"
19485
script = '''
19586
cargo-binstall golem-cli@1.2.2-dev.11 --locked --no-confirm
19687
cargo-binstall wac-cli --locked --no-confirm
19788
cd ../test
19889
19990
golem-cli --version
20091
golem-cli app clean
201-
golem-cli app build -b anthropic-debug
202-
golem-cli app clean
203-
golem-cli app build -b grok-debug
204-
golem-cli app clean
205-
golem-cli app build -b openai-debug
206-
golem-cli app clean
207-
golem-cli app build -b openrouter-debug
208-
golem-cli app clean
209-
golem-cli app build -b ollama-debug
92+
golem-cli app build -b algolia-debug
21093
'''

search/algolia/Cargo.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
name = "golem-search-algolia"
3+
version = "0.0.0"
4+
edition = "2021"
5+
license = "Apache-2.0"
6+
homepage = "https://golem.cloud"
7+
repository = "https://github.com/golemcloud/golem-llm"
8+
description = "WebAssembly component for working with Algolia APIs, with special support for Golem Cloud"
9+
10+
[lib]
11+
path = "src/lib.rs"
12+
crate-type = ["cdylib"]
13+
14+
15+
[features]
16+
default = ["durability"]
17+
durability = ["golem-rust/durability", "golem-search/durability"]
18+
19+
[dependencies]
20+
golem-search = { path = "../search", version = "0.0.0", default-features = false }
21+
base64 = "0.21"
22+
mime_guess = "2.0"
23+
url = "2.4"
24+
25+
golem-rust = { workspace = true }
26+
log = { workspace = true }
27+
reqwest = { workspace = true }
28+
serde.workspace = true
29+
serde_json = { workspace = true }
30+
wit-bindgen-rt = { workspace = true }
31+
32+
33+
[package.metadata.component]
34+
package = "golem:search-algolia"
35+
36+
[package.metadata.component.bindings]
37+
generate_unused_types = true
38+
39+
[package.metadata.component.bindings.with]
40+
"golem:search/search@1.0.0" = "golem_search::golem::search::search"
41+
42+
[package.metadata.component.target]
43+
path = "wit"
44+
45+
[package.metadata.component.target.dependencies]
46+
"golem:search" = { path = "wit/deps/golem-search" }
47+
"wasi:io" = { path = "wit/deps/wasi:io" }

0 commit comments

Comments
 (0)