Skip to content

feat: added common embeddings providers components #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
09b7c23
refactor:moved all llm packages to "golem-llm" folder and updated CI …
Rutik7066 May 28, 2025
4d0ed25
ci fix
Rutik7066 May 28, 2025
e358a21
CI fixes
Rutik7066 May 29, 2025
e78d6ad
added embed
Rutik7066 May 30, 2025
3fc5f48
openai client generate embedings
Rutik7066 May 30, 2025
18bcc0a
wip
Rutik7066 Jun 1, 2025
421703f
fix
Rutik7066 Jun 1, 2025
739e108
wip
Rutik7066 Jun 3, 2025
5b63d0c
wip
Rutik7066 Jun 3, 2025
da96284
cohere generate
Rutik7066 Jun 3, 2025
a71efee
init hugging_face
Rutik7066 Jun 3, 2025
a70afbf
wip
Rutik7066 Jun 5, 2025
de4c3f4
wip
Rutik7066 Jun 6, 2025
07e2ca9
wip
Rutik7066 Jun 7, 2025
37f30d3
durability
Rutik7066 Jun 8, 2025
62a0ba3
fixes
Rutik7066 Jun 8, 2025
09572e1
test
Rutik7066 Jun 8, 2025
a9a6634
fixes
Rutik7066 Jun 9, 2025
815e38d
hf
Rutik7066 Jun 10, 2025
9a8e033
testing & fixing
Rutik7066 Jun 11, 2025
a6a4683
build fix
Rutik7066 Jun 11, 2025
b004994
fix cohere
Rutik7066 Jun 11, 2025
32ab369
fixes
Rutik7066 Jun 13, 2025
4c022f1
undo refactor
Rutik7066 Jun 13, 2025
1e5432e
clippy
Rutik7066 Jun 13, 2025
9f9a6ec
ci fix
Rutik7066 Jun 13, 2025
880c527
openai test fix
Rutik7066 Jun 15, 2025
bdb3c23
ci fix
Rutik7066 Jun 15, 2025
d8aafd8
unit test fix
Rutik7066 Jun 15, 2025
664f4c7
clippy
Rutik7066 Jun 15, 2025
b3e7dc5
redme and made some fixes
Rutik7066 Jun 25, 2025
9753f4b
Merge remote-tracking branch 'origin/main' into embed
Rutik7066 Jun 25, 2025
796d7d7
rebased with latest project structure
Rutik7066 Jun 25, 2025
7e76583
fixes
Rutik7066 Jun 25, 2025
f4f71c7
ci fixes
Rutik7066 Jun 27, 2025
16a36da
removed println
Rutik7066 Jun 27, 2025
5818aee
lint
Rutik7066 Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- name: Build and test Ollama integration
run: |
set -e
cargo make --cwd llm build-ollama
cargo make build
cd test
golem-cli app build -b ollama-debug
golem-cli app deploy -b ollama-debug
Expand Down Expand Up @@ -183,4 +183,4 @@ jobs:
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release upload -R golemcloud/golem-llm --clobber ${{ github.ref_name }} components/release/*.wasm
- run: gh release upload -R golemcloud/golem-llm --clobber ${{ github.ref_name }} components/release/*.wasm
79 changes: 79 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ members = [
"llm/ollama",
"llm/openai",
"llm/openrouter",
"embed/embed",
"embed/cohere",
"embed/hugging-face",
"embed/openai",
"embed/voyageai",
]

[profile.release]
Expand Down
24 changes: 15 additions & 9 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ skip_core_tasks = true
command = "cargo"
args = ["clean"]

[tasks.clean-all]
script_runner = "@duckscript"
script = '''
exec find . -type d \( -name "target" -o -name "wit-generated" -o -name "golem-temp" \) -exec rm -rf {} +
'''

[tasks.unit-tests]
command = "cargo"
args = ["test"]

[tasks.build]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -28,7 +34,7 @@ end
[tasks.release-build]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -44,7 +50,7 @@ end
script_runner = "@duckscript"
script = '''
#!/bin/bash
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -60,7 +66,7 @@ end
script_runner = "@duckscript"
script = '''
#!/bin/bash
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -75,7 +81,7 @@ end
[tasks.wit]
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand All @@ -91,7 +97,7 @@ end
description = "Builds all test components with golem-cli"
script_runner = "@duckscript"
script = '''
domains = array llm
domains = array llm embed

# if there is no domain passed run for every domain
if is_empty ${1}
Expand Down Expand Up @@ -137,7 +143,7 @@ script = '''

is_portable = eq ${1} "--portable"

targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama embed_openai embed_cohere embed_hugging_face embed_voyageai
for target in ${targets}
if is_portable
cp target/wasm32-wasip1/debug/golem_${target}.wasm components/debug/golem_${target}-portable.wasm
Expand All @@ -153,7 +159,7 @@ script = '''

is_portable = eq ${1} "--portable"

targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama
targets = array llm_openai llm_anthropic llm_grok llm_openrouter llm_ollama embed_openai embed_cohere embed_hugging_face embed_voyageai
for target in ${targets}
if is_portable
cp target/wasm32-wasip1/release/golem_${target}.wasm components/release/golem_${target}-portable.wasm
Expand Down Expand Up @@ -229,4 +235,4 @@ foreach ($file in $cargoFiles)
Foreach-Object { $_ -replace "0.0.0", $Env:VERSION } |
Set-Content $file.PSPath
}
'''
'''
169 changes: 169 additions & 0 deletions embed/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
[config]
default_to_workspace = false
skip_core_tasks = true

[tasks.build]
run_task = { name = [
"build-openai",
"build-cohere",
"build-hugging-face",
"build-voyageai",
] }

[tasks.build-portable]
run_task = { name = [
"build-openai-portable",
"build-cohere-portable",
"build-hugging-face-portable",
"build-voyageai-portable",
] }

[tasks.release-build]
run_task = { name = [
"release-build-openai",
"release-build-cohere",
"release-build-hugging-face",
"release-build-voyageai",
] }

[tasks.release-build-portable]
run_task = { name = [
"release-build-openai-portable",
"release-build-cohere-portable",
"release-build-hugging-face-portable",
"release-build-voyageai-portable",
] }

[tasks.build-openai]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-openai"]

[tasks.build-openai-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-openai", "--no-default-features"]

[tasks.build-cohere]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-cohere"]

[tasks.build-cohere-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-cohere", "--no-default-features"]

[tasks.build-hugging-face]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-hugging-face"]

[tasks.build-hugging-face-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-hugging-face", "--no-default-features"]

[tasks.build-voyageai]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-voyageai"]

[tasks.build-voyageai-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-voyageai", "--no-default-features"]

[tasks.release-build-openai]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-openai", "--release"]

[tasks.release-build-openai-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-openai", "--release", "--no-default-features"]

[tasks.release-build-cohere]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-cohere", "--release"]

[tasks.release-build-cohere-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-cohere", "--release", "--no-default-features"]

[tasks.release-build-hugging-face]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-hugging-face", "--release"]

[tasks.release-build-hugging-face-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-hugging-face", "--release", "--no-default-features"]

[tasks.release-build-voyageai]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-voyageai", "--release"]

[tasks.release-build-voyageai-portable]
install_crate = { crate_name = "cargo-component", version = "0.20.0" }
command = "cargo-component"
args = ["build", "-p", "golem-embed-voyageai", "--release", "--no-default-features"]

[tasks.wit-update]
install_crate = { crate_name = "wit-deps-cli" }
command = "wit-deps"
args = ["update"]

[tasks.wit]
dependencies = ["wit-update"]

script_runner = "@duckscript"
script = """
modules = array embed openai cohere hugging-face voyageai

for module in ${modules}
rm -r ${module}/wit/deps
mkdir ${module}/wit/deps/golem-embed
cp wit/golem-embed.wit ${module}/wit/deps/golem-embed/golem-embed.wit
cp wit/deps/wasi:io ${module}/wit/deps

echo "Copied WIT for module embed::${module}"
end

# Copy WIT files for integration tests
rm -r test/wit
mkdir test/wit/deps/golem-embed
mkdir test/wit/deps/io
cp wit/golem-embed.wit test/wit/deps/golem-embed/golem-embed.wit
cp wit/deps/wasi:io/error.wit test/wit/deps/io/error.wit
cp wit/deps/wasi:io/poll.wit test/wit/deps/io/poll.wit
cp wit/deps/wasi:io/streams.wit test/wit/deps/io/streams.wit
cp wit/deps/wasi:io/world.wit test/wit/deps/io/world.wit

echo "Copied WIT for module test"
"""

[tasks.build-test-components]
dependencies = ["build"]
install_crate = "cargo-binstall"
description = "Builds embed test components with golem-cli"
script = '''
cargo-binstall golem-cli@1.2.2-dev.11 --locked --no-confirm
cargo-binstall wac-cli --locked --no-confirm
cd test

golem-cli --version
golem-cli app clean
golem-cli app build -b openai-debug
golem-cli app clean
golem-cli app build -b cohere-debug
golem-cli app clean
golem-cli app build -b hugging-face-debug
golem-cli app clean
golem-cli app build -b voyageai-debug
'''
Loading
Loading