Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
**/target

**/*.wasm
**/*.cwasm

**/.projects.json
6 changes: 4 additions & 2 deletions apps/compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GO_COMPONENT_NAME := service.wasm
SERVER_COMPONENT_PATH := $(ROOT_DIR)/app-js/$(SERVER_COMPONENT_NAME)
GO_COMPONENT_PATH := $(ROOT_DIR)/service-go/$(GO_COMPONENT_NAME)
COMPOSED_COMPONENT_PATH := $(ROOT_DIR)/composed.wasm
COMPOSED_COMPILED_COMPONENT_PATH := $(ROOT_DIR)/composed.cwasm
.DEFAULT_GOAL:=help

## --------------------------------------
Expand All @@ -31,11 +32,12 @@ build-compose: ## Compose the microservice app with the constituent components.
$(info "Fusing components together with wac...")
# @wac plug --plug $(GO_COMPONENT_PATH) -o composed.wasm $(SERVER_COMPONENT_PATH)
wac compose --dep example:service=$(GO_COMPONENT_PATH) --dep example:server=$(SERVER_COMPONENT_PATH) -o composed.wasm compose.wac
wasmtime compile $(COMPOSED_COMPONENT_PATH)

.PHONY: run
run: ## Run the microservice app after build.
$(info "Running Component Application Using Wasmtime...")
wasmtime serve -S cli --env OPENAI_API_KEY="$${OPENAI_API_KEY}" $(COMPOSED_COMPONENT_PATH)
wasmtime serve -S cli --env OPENAI_API_KEY --allow-precompiled $(COMPOSED_COMPILED_COMPONENT_PATH)

.PHONY: build-and-run
build-and-run: build run ## Build and run the microservice app.
Expand All @@ -45,7 +47,7 @@ build-and-run: build run ## Build and run the microservice app.
.PHONY: clean
clean: ## Clean up the build artifacts.
@echo "Cleaning up build artifacts..."
@rm -rf $(SERVER_COMPONENT_PATH) $(GO_COMPONENT_PATH) $(COMPOSED_COMPONENT_PATH)
@rm -rf $(SERVER_COMPONENT_PATH) $(GO_COMPONENT_PATH) $(COMPOSED_COMPONENT_PATH) $(COMPOSED_COMPILED_COMPONENT_PATH)

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
1 change: 0 additions & 1 deletion apps/compose/app-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"rollup-plugin-polyfill-node": "^0.13.0"
},
"scripts": {
"build:jco": "jco types -h ./wit",
"build:rollup": "rollup -c",
"build": "wkg wit fetch && npm run build:rollup && node componentize.js"
},
Expand Down
3 changes: 1 addition & 2 deletions apps/compose/app-js/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ router
.get("/chat", (request) => {
let prompt = request.query["prompt"];
let chatRequest = {
model: "gpt-3.5-turbo",
model: "gpt-4o-mini",
messages: [
{
role: "user",
Expand All @@ -42,7 +42,6 @@ router

// send the request to the chat function, which is the Golang backend component.
let result = chat(chatRequest);
console.log("result", result);
return {
result: result,
};
Expand Down
2 changes: 1 addition & 1 deletion apps/compose/service-go/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func init() {

run.Exports.Run = func() cm.BoolResult {
res, err := chatCompletion(chat.ChatRequest{
Model: "gpt-4o",
Model: "gpt-4o-mini",
Messages: cm.ToList([]domainTypes.Message{
{
Role: "user",
Expand Down
17 changes: 0 additions & 17 deletions buildpacks/python/bin/build

This file was deleted.

29 changes: 0 additions & 29 deletions buildpacks/python/bin/detect

This file was deleted.

11 changes: 0 additions & 11 deletions buildpacks/python/buildpack.toml

This file was deleted.

7 changes: 5 additions & 2 deletions buildpacks/wac-composer/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ echo "wac-composer: running compose command: '${compose_cmd}' to create composed
# command should look something like: `wac compose --dep example:math=./component_path1/math.wasm --dep example:server=./component_path2/server.wasm -o composed.wasm compose.wac`
$compose_cmd

wasmtime compile composed.wasm

wasm_component_layer="${CNB_LAYERS_DIR}/wac-composer"
mkdir -p "${wasm_component_layer}"
cat > "${wasm_component_layer}.toml" << EOL
Expand All @@ -31,12 +33,13 @@ cache = false
build = false
EOL

cp composed.wasm "${wasm_component_layer}"
cp composed.cwasm "${wasm_component_layer}"

# Set default start command
cat > "${CNB_LAYERS_DIR}/launch.toml" << EOL
[[processes]]
type = "web"
command = ["wasmtime", "serve", "-S", "cli", "${wasm_component_layer}/composed.wasm"]
command = ["wasmtime"]
args = ["serve", "-S", "cli", "--env", "OPENAI_API_KEY", "--allow-precompiled", "${wasm_component_layer}/composed.cwasm"]
default = true
EOL