Skip to content

Commit 400c50a

Browse files
derhnyelEjedavydeven96
authored
Go grpc client (#204)
* Squashed commit of the following: commit 46b65dd Author: David Onuh <[email protected]> Date: Mon Aug 12 08:58:14 2024 +0100 AIProxy Set Command Preprocessing actions for storeinputs (#77) * Add a new field preprocess_action for aiproxy set command * Add preprocess_action field to python client * Add new fields for aiproxy create store commands * Update python client after changes to create store command * Remove index and query types from aiproxy create store * Update python client with changes to aiproxy create store params * - Pass preproccess actions to set command - Create base on how to edit inputtypes and convert to storekeys - Move preprocessing actions - Tie model info into aimodel - Fix fmt trait on AIStoreInputTypes * regenerate types for python client * Create ai model struct to hold info about supported models, Implement additional functions on aimodel types via traits * Cleanup and rename aistoreinputtypes * Improvements to preprocessing logic, remove &mut references commit 0325f15 Author: David Onuh <[email protected]> Date: Wed Jul 31 21:45:19 2024 +0100 Rename StoreInput and MetadataValue Variant From Binary to Image (#76) * Change storeinput and metavalue variant from binary to image, remove store_type from aiproxy create_store * Fix python lib after change in types and update readme commit 44b6181 Author: David Onuh <[email protected]> Date: Wed Jul 31 19:14:06 2024 +0100 Create Rust AIProxy Client (#75) * WIP: AIProxy Client - Move client's connection send and read logic to trait * Create AIproxy rust client * add some tests to rust ai proxy client * update documentation for ai proxy * add tests for aiproxy get pred command * AI and DB Conn struct rename and doc update * Add more binary store tests, Change AIProxyServer, now owns aiproxyconfig * update aiclient get pred tests and remove unnessary clone commit 6740dba Author: Diretnan Domnan <[email protected]> Date: Thu Jul 25 00:54:24 2024 +0200 Check connected clients before accepting connection (#74) commit 277fda3 Author: David Onuh <[email protected]> Date: Wed Jul 24 22:44:31 2024 +0100 cleanup golang typegen (#73) commit ae272ff Merge: a0766ad 6bf53d7 Author: David Onuh <[email protected]> Date: Wed Jul 24 22:13:28 2024 +0100 Merge pull request #72 from deven96/diretnan/fix-persistence Fixing persistence issues from predicate index commit 6bf53d7 Author: Diretnan Domnan <[email protected]> Date: Wed Jul 24 22:51:28 2024 +0200 Fixing persistence issues from predicate index commit a0766ad Author: David Onuh <[email protected]> Date: Mon Jul 22 21:01:07 2024 +0100 AI Proxy Persistence (#70) * Add persistence for ahnlich ai and add new command(destroy_database) for ai_proxy * update destroydb command to purge stores * add ai purge commands to python ai client and update readme commit 20b6c63 Author: David Onuh <[email protected]> Date: Mon Jul 22 11:35:45 2024 +0100 Add AI Proxy client (#71) * seperate db client and tests from aiproxy * create ai base client and cleanup * default args cleanup * rename pool class * fleshout ai client commands * fix typespec with incomplete servertypes * update python client test workflow for aiproxy * add aiproxy tests for store commands * isolate db tests * update readme, update ai test and remove dependency on ci spinning up db and ai servers * fix typegen, trace AIStoreType * bump python client version * cleanup workflow commit c3d8f32 Author: David Onuh <[email protected]> Date: Thu Jul 18 21:11:19 2024 +0100 Python client connection pooling fix and add context manager capability to protocol (#69) * utilize connection pool properly. Add ability to use protocol as a context * add formatting and linting to python actions * Refactor: Make protocol dep internal - extract base class needed by clients. - Add ai_response, ai_query - Update tests and Readme * format * fix python import path and update readme commit 5c397a1 Author: David Onuh <[email protected]> Date: Tue Jul 16 15:05:03 2024 +0100 Setup Basic AI Proxy Types (#49) * Create ai-proxy query enum * Use storeinputs instead of metadatavalue * add ai server response for queries * add aiserver response * Trace ai db queries and server responses for clients * Setup entry point for ai_proxy, using db parts * WIP: moving ahnlich protocol to traits * Use traits to handle ahnlich protocol * Cleanup unused errors by ai * rename to ai instead of ahnlich_ai * Fleshing out commands * Adding dbclient to tasks * Move dbclient to aiproxy task and some cleanups * Change ai set query format * Add set command for ai proxy * Add getsimn variant * Update ai query commands to match db(create_pred_index, drop_pred_index) * Initialize reserved metadatakey * Add ai allocator and begin tests for ai * More tests for ahnlich ai proxy * remove test for unavailability * update todos and regen typespecs * Match portion of error in aiproxytests commit 94eb429 Author: David Onuh <[email protected]> Date: Tue Jul 16 15:03:49 2024 +0100 update typegen golang format (#68) * update typegen format * clippy fmt * Change golang typegen format to generate mods for each file * feat: add publich test file * feat: add grpc proto files * Changes to proto and workspace * Added tests for go client * uncommented python generation * uncommented python generation * Tests working * feat: add go test to actions * chore: format and lint go-files * Added warm up to tests * Removed unwanted tests * Removed warm up programmatically * feat: fix benchmark with docker image cache * feat: add readme * chore: fix lint and formatter * fix tests --------- Co-authored-by: David Eje <[email protected]> Co-authored-by: Diretnan Domnan <[email protected]>
1 parent e840ba4 commit 400c50a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+14305
-154
lines changed

.github/workflows/benchmark.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ jobs:
2222
uses: Swatinem/rust-cache@v2
2323
with:
2424
workspaces: ahnlich
25-
26-
- name: Install Protoc
27-
uses: arduino/setup-protoc@v3
25+
26+
- name: Install protoc
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y protobuf-compiler
30+
31+
- name: Cache Docker images.
32+
uses: ScribeMD/[email protected]
33+
with:
34+
key: ${{ runner.os }}-cargo-${{ hashFiles('ahnlich/Cargo.lock') }}
2835

2936
- name: Install Cargo benchcmp
3037
working-directory: ./ahnlich

.github/workflows/rust_tag_and_deploy.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ jobs:
6868
with:
6969
toolchain: 1.88.0
7070

71-
- name: Install Protoc
72-
uses: arduino/setup-protoc@v3
71+
- name: Install protoc
72+
run: |
73+
sudo apt-get update
74+
sudo apt-get install -y protobuf-compiler
7375
7476
- name: Deploy using tag
7577
working-directory: ./ahnlich

.github/workflows/test.yml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ jobs:
3030
run: |
3131
which cargo-nextest || cargo install cargo-nextest
3232
33-
- name: Install Protoc
34-
uses: arduino/setup-protoc@v3
33+
- name: Install protoc
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y protobuf-compiler
3537
3638
- name: Cache Docker images.
3739
uses: ScribeMD/[email protected]
@@ -109,8 +111,10 @@ jobs:
109111
poetry run isort . -c --profile black; echo $?
110112
poetry run black . --check; echo $?
111113
112-
- name: Install Protoc
113-
uses: arduino/setup-protoc@v3
114+
- name: Install protoc
115+
run: |
116+
sudo apt-get update
117+
sudo apt-get install -y protobuf-compiler
114118
115119
- name: Complie Binaries
116120
working-directory: ./ahnlich
@@ -143,13 +147,51 @@ jobs:
143147
with:
144148
name: python
145149
path: sdk/ahnlich-client-py/python.xml
150+
146151

147-
152+
run-go-tests:
153+
if: always()
154+
runs-on: ubuntu-latest
155+
steps:
156+
- uses: actions/checkout@v4
157+
- name: Set up Rust cache
158+
uses: Swatinem/rust-cache@v2
159+
with:
160+
workspaces: ahnlich
161+
162+
- name: Install Protoc
163+
uses: arduino/setup-protoc@v3
164+
165+
- name: Setup Go Environment
166+
uses: actions/setup-go@v5
167+
with:
168+
go-version: 1.22
169+
cache-dependency-path: ./sdk/ahnlich-client-go/go.sum
170+
171+
- name: Install Dependencies
172+
working-directory: ./sdk/ahnlich-client-go
173+
run: make install-dependencies CI=1
174+
175+
- name: Format and Lint Check
176+
working-directory: ./sdk/ahnlich-client-go
177+
run: make pre-commit-check
178+
179+
- name: Run Tests
180+
working-directory: ./sdk/ahnlich-client-go
181+
run: |
182+
make test CACHE=1 REPORT=1
183+
184+
- name: Upload Test Results
185+
uses: actions/upload-artifact@v4
186+
if: always()
187+
with:
188+
name: go
189+
path: sdk/ahnlich-client-go/go.xml
148190

149191
upload-test-results:
150192
if: always()
151193
runs-on: ubuntu-latest
152-
needs: ["run-rust-tests", "run-python-tests"]
194+
needs: ["run-rust-tests", "run-python-tests", "run-go-tests"]
153195

154196
steps:
155197
- name: Download Rust Test Output
@@ -163,6 +205,12 @@ jobs:
163205
with:
164206
name: python
165207
path: ./python
208+
209+
- name: Download Go Test Output
210+
uses: actions/download-artifact@v4
211+
with:
212+
name: go
213+
path: ./go
166214

167215
- name: Publish Test Results
168216
uses: EnricoMi/publish-unit-test-result-action/macos@v2
@@ -171,3 +219,4 @@ jobs:
171219
files: |
172220
rust/*.xml
173221
python/*.xml
222+
go/*.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ data/
2929
profiling.json*
3030

3131
**/.idea/
32+
.trunk/

protos/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ------------------------------------------------------------------------
2+
# Makefile – fixed: buf format gets one source argument
3+
# ------------------------------------------------------------------------
4+
5+
.PHONY: format lint lock breaking generate all help
6+
7+
# Default target ─ run the full pipeline
8+
all: generate
9+
10+
## Format code
11+
format:
12+
@echo "➜ Formatting protobuf files"
13+
# Passing '.' keeps buf happy and recursively formats every *.proto
14+
buf format -w .
15+
16+
## Lint proto files
17+
lint:
18+
@echo "➜ Linting protobuf files"
19+
buf lint .
20+
21+
## Lock dependencies
22+
lock:
23+
@echo "➜ Updating buf module dependencies"
24+
buf mod update
25+
26+
## Check for breaking changes (runs from parent dir)
27+
breaking:
28+
@echo "➜ Checking for breaking changes against main branch"
29+
(cd .. && buf breaking --against '.git#branch=main' protos)
30+
31+
## Generate code with protoc plugins
32+
generate: lock format lint
33+
@echo "➜ Generating code"
34+
buf generate
35+
@echo "✓ Done"
36+
37+
## Show available targets with descriptions
38+
help:
39+
@grep -E '^##' -n Makefile | sed 's/^.*## //' | column -t -s ':'
40+
41+
# Ensure protoc and plugins are installed
42+
PROTOC := $(shell which protoc)
43+
PROTOC_GEN_GO := $(shell which protoc-gen-go)
44+
PROTOC_GEN_GO_GRPC := $(shell which protoc-gen-go-grpc)
45+
BUF := $(shell which buf)
46+
47+
.PHONY: deps
48+
deps:
49+
ifndef PROTOC
50+
@echo "❌ protoc is not installed. Please install it manually:"
51+
@echo " - macOS: brew install protobuf"
52+
@echo " - Ubuntu: sudo apt install -y protobuf-compiler"
53+
@echo " - Or download from: https://github.com/protocolbuffers/protobuf/releases"
54+
@exit 1
55+
endif
56+
ifndef PROTOC_GEN_GO
57+
@echo "Installing protoc-gen-go..."
58+
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
59+
endif
60+
ifndef PROTOC_GEN_GO_GRPC
61+
@echo "Installing protoc-gen-go-grpc..."
62+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
63+
endif
64+
@echo "✅ All dependencies installed."
65+
ifndef BUF
66+
@echo "Installing buf..."
67+
go install github.com/bufbuild/buf/cmd/buf@latest
68+
endif
69+
@echo "✅ buf installed."

protos/ai/execution_provider.proto

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
21
syntax = "proto3";
32

43
package ai.execution_provider;
54

6-
5+
option go_package = "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/execution_provider;execution_provider";
76

87
// Enum for Execution Providers
98
enum ExecutionProvider {
10-
TENSOR_RT = 0;
11-
CUDA = 1;
12-
DIRECT_ML = 2;
13-
CORE_ML = 3;
14-
}
9+
TENSOR_RT = 0;
10+
CUDA = 1;
11+
DIRECT_ML = 2;
12+
CORE_ML = 3;
13+
}

protos/ai/models.proto

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
21
syntax = "proto3";
32

43
package ai.models;
54

5+
option go_package = "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/models;models";
66

77
enum AIModel {
8-
ALL_MINI_LM_L6_V2 = 0;
9-
ALL_MINI_LM_L12_V2 = 1;
10-
BGE_BASE_EN_V15 = 2;
11-
BGE_LARGE_EN_V15 = 3;
12-
RESNET50 = 4;
13-
CLIP_VIT_B32_IMAGE = 5;
14-
CLIP_VIT_B32_TEXT = 6;
8+
ALL_MINI_LM_L6_V2 = 0;
9+
ALL_MINI_LM_L12_V2 = 1;
10+
BGE_BASE_EN_V15 = 2;
11+
BGE_LARGE_EN_V15 = 3;
12+
RESNET50 = 4;
13+
CLIP_VIT_B32_IMAGE = 5;
14+
CLIP_VIT_B32_TEXT = 6;
1515
}
1616

1717
// Enum for AI Store Input Types
1818
enum AIStoreInputType {
19-
RAW_STRING = 0;
20-
IMAGE = 1;
19+
RAW_STRING = 0;
20+
IMAGE = 1;
2121
}

protos/ai/pipeline.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "ai/query.proto";
66
import "ai/server.proto";
77
import "shared/info.proto";
88

9+
option go_package = "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/pipeline;pipeline";
10+
911
message AIQuery {
1012
oneof query {
1113
ai.query.CreateStore create_store = 1;

protos/ai/preprocess.proto

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
21
syntax = "proto3";
32

43
package ai.preprocess;
54

5+
option go_package = "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/preprocess;preprocess";
6+
67
enum PreprocessAction {
7-
NoPreprocessing = 0;
8-
ModelPreprocessing = 1;
9-
}
8+
NoPreprocessing = 0;
9+
ModelPreprocessing = 1;
10+
}

0 commit comments

Comments
 (0)