Skip to content

Commit 64143c3

Browse files
authored
feat(llm): Add Google LLM providers (#21)
2 parents 973c377 + 6044956 commit 64143c3

27 files changed

+13243
-7
lines changed

src/llm/src/_index.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,31 @@ entries:
2424
path: ".storage"
2525
- entry: wippy.llm.openai:timeout
2626
path: ".storage"
27+
- entry: wippy.llm.google.env:vertex_base_url
28+
path: ".storage"
29+
- entry: wippy.llm.google.env:generative_ai_base_url
30+
path: ".storage"
31+
- entry: wippy.llm.google.env:vertex_location
32+
path: ".storage"
33+
- entry: wippy.llm.google.env:vertex_timeout
34+
path: ".storage"
35+
- entry: wippy.llm.google.env:generative_ai_timeout
36+
path: ".storage"
37+
- entry: wippy.llm.google.env:api_key
38+
path: ".storage"
39+
- entry: wippy.llm.google.env:google_credentials
40+
path: ".storage"
41+
42+
- name: process_host
43+
kind: ns.requirement
44+
meta:
45+
description: "Host ID for processes"
46+
targets:
47+
- entry: wippy.llm.google.oauth2:token_refresher
48+
path: ".meta.default_host"
49+
- entry: wippy.llm.google.oauth2:token_refresher.service
50+
path: ".host"
51+
default: "app:processes"
2752

2853
# Dependencies
2954
- name: __dependency.wippy.test
@@ -256,9 +281,7 @@ entries:
256281
- providers
257282
source: file://llm.lua
258283
modules:
259-
- uuid
260284
- security
261-
- json
262285
imports:
263286
contract: contract
264287
models: wippy.llm.discovery:models

src/llm/src/google/_index.yaml

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
version: "1.0"
2+
namespace: wippy.llm.google
3+
4+
entries:
5+
# wippy.llm.google:client_contract
6+
- name: client_contract
7+
kind: contract.definition
8+
meta:
9+
comment: Client interface for Google LLM providers
10+
description: Defines the methods and schemas for interacting with Google LLM services.
11+
methods:
12+
- name: request
13+
description: Make a request to the LLM service
14+
input_schemas:
15+
- definition: |
16+
{
17+
"type": "object",
18+
"properties": {
19+
"endpoint_path": {
20+
"type": "string",
21+
"description": "API endpoint path"
22+
},
23+
"model": {
24+
"type": "string",
25+
"description": "Model name"
26+
},
27+
"payload": {
28+
"type": "object",
29+
"description": "Request payload",
30+
"additionalProperties": true
31+
},
32+
"options": {
33+
"type": "object",
34+
"description": "Additional request options",
35+
"additionalProperties": true
36+
}
37+
},
38+
"additionalProperties": true
39+
}
40+
format: application/schema+json
41+
output_schemas:
42+
- definition: |
43+
{
44+
"type": "object",
45+
"properties": {
46+
"status_code": {
47+
"type": "integer",
48+
"description": "HTTP status code of the response"
49+
},
50+
"message": {
51+
"type": "string",
52+
"description": "Error message if the request failed"
53+
},
54+
"createTime": {
55+
"type": "string",
56+
"format": "date-time",
57+
"description": "Timestamp when the response was created"
58+
},
59+
"responseId": {
60+
"type": "string",
61+
"description": "Unique identifier for the response"
62+
},
63+
"modelVersion": {
64+
"type": "string",
65+
"description": "Version of the model used"
66+
},
67+
"candidates": {
68+
"type": "array",
69+
"description": "Array of response candidates",
70+
"items": {
71+
"type": "object"
72+
}
73+
},
74+
"usageMetadata": {
75+
"type": "object",
76+
"description": "Metadata about token usage",
77+
"properties": {
78+
"totalTokenCount": {
79+
"type": "integer",
80+
"minimum": 0,
81+
"description": "Total number of tokens used"
82+
},
83+
"thoughtsTokenCount": {
84+
"type": "integer",
85+
"minimum": 0,
86+
"description": "Number of tokens used for thoughts/reasoning"
87+
},
88+
"promptTokenCount": {
89+
"type": "integer",
90+
"minimum": 0,
91+
"description": "Number of tokens in the prompt"
92+
},
93+
"candidatesTokenCount": {
94+
"type": "integer",
95+
"minimum": 0,
96+
"description": "Number of tokens in the candidates"
97+
}
98+
}
99+
}
100+
}
101+
}
102+
format: application/schema+json
103+
104+
# wippy.llm.google:client
105+
- name: client
106+
kind: library.lua
107+
meta:
108+
type: library
109+
comment: Google low-level HTTP client
110+
tags:
111+
- google
112+
source: file://client.lua
113+
modules:
114+
- json
115+
- http_client
116+
117+
# wippy.llm.google:client_test
118+
- name: client_test
119+
kind: function.lua
120+
meta:
121+
name: Google low-level HTTP client Unit Tests
122+
type: test
123+
comment: Unit tests for Google low-level HTTP client
124+
group: LLM / Drivers / Google
125+
tags:
126+
- unit-test
127+
- google_http_client
128+
source: file://client_test.lua
129+
modules:
130+
- json
131+
imports:
132+
google_client: wippy.llm.google:client
133+
test: wippy.test:test
134+
method: run_tests
135+
136+
# wippy.llm.google:config
137+
- name: config
138+
kind: library.lua
139+
meta:
140+
type: library
141+
comment: Google configuration library
142+
tags:
143+
- google
144+
source: file://config.lua
145+
modules:
146+
- base64
147+
- json
148+
- env
149+
- store
150+
- ctx
151+
152+
# wippy.llm.google:config_test
153+
- name: config_test
154+
kind: function.lua
155+
meta:
156+
name: Google configuration Unit Tests
157+
type: test
158+
comment: Unit tests for Google configuration
159+
group: LLM / Drivers / Google
160+
tags:
161+
- unit-test
162+
- configuration
163+
source: file://config_test.lua
164+
modules:
165+
- base64
166+
- json
167+
imports:
168+
google_config: wippy.llm.google:config
169+
test: wippy.test:test
170+
method: run_tests
171+
172+
# wippy.llm.google:generate
173+
- name: generate
174+
kind: function.lua
175+
meta:
176+
comment: Google text generation handler supporting tool calling, and reasoning models via unified contract
177+
source: file://generate.lua
178+
modules:
179+
- contract
180+
- ctx
181+
imports:
182+
google_mapper: wippy.llm.google:mapper
183+
output: wippy.llm:output
184+
google_config: wippy.llm.google:config
185+
method: handler
186+
187+
# wippy.llm.google:generate_test
188+
- name: generate_test
189+
kind: function.lua
190+
meta:
191+
name: Google Generate Handler Unit Tests
192+
type: test
193+
comment: Unit tests for Google generate handler
194+
group: LLM / Drivers / Google
195+
tags:
196+
- unit-test
197+
- generation
198+
source: file://generate_test.lua
199+
modules:
200+
- base64
201+
- json
202+
imports:
203+
google_generate: wippy.llm.google:generate
204+
test: wippy.test:test
205+
method: run_tests
206+
207+
# wippy.llm.google:integration_test
208+
- name: integration_test
209+
kind: function.lua
210+
meta:
211+
name: Google Integration Tests
212+
type: test
213+
comment: Integration tests for Google LLM driver
214+
group: LLM / Drivers / Google
215+
tags:
216+
- integration-test
217+
- google
218+
source: file://integration_test.lua
219+
modules:
220+
- env
221+
imports:
222+
google_generate: wippy.llm.google:generate
223+
google_structured_output: wippy.llm.google:structured_output
224+
test: wippy.test:test
225+
method: run_tests
226+
227+
# wippy.llm.google:mapper
228+
- name: mapper
229+
kind: library.lua
230+
meta:
231+
comment: Google contract mapper with consistent error handling, token usage mapping, and reasoning detection
232+
source: file://mapper.lua
233+
modules:
234+
- json
235+
- time
236+
imports:
237+
output: wippy.llm:output
238+
239+
# wippy.llm.google:mapper_test
240+
- name: mapper_test
241+
kind: function.lua
242+
meta:
243+
name: Google Mapper Unit Tests
244+
type: test
245+
comment: Unit tests for Google mapper
246+
group: LLM / Drivers / Google
247+
tags:
248+
- unit-test
249+
- mapper
250+
source: file://mapper_test.lua
251+
imports:
252+
google_mapper: wippy.llm.google:mapper
253+
test: wippy.test:test
254+
method: run_tests
255+
256+
# wippy.llm.google:status
257+
- name: status
258+
kind: function.lua
259+
meta:
260+
comment: Google provider status handler for health checks and connection testing
261+
source: file://status.lua
262+
modules:
263+
- contract
264+
- ctx
265+
imports:
266+
google_config: wippy.llm.google:config
267+
method: handler
268+
269+
# wippy.llm.google:status_test
270+
- name: status_test
271+
kind: function.lua
272+
meta:
273+
name: Google provider status handler Unit Tests
274+
type: test
275+
comment: Unit tests for Google provider status handler
276+
group: LLM / Drivers / Google
277+
tags:
278+
- unit-test
279+
- status
280+
source: file://status_test.lua
281+
imports:
282+
google_status: wippy.llm.google:status
283+
test: wippy.test:test
284+
method: run_tests
285+
286+
# wippy.llm.google:structured_output
287+
- name: structured_output
288+
kind: function.lua
289+
meta:
290+
comment: Google structured output handler with JSON schema validation and reasoning model support via unified contract
291+
source: file://structured_output.lua
292+
modules:
293+
- contract
294+
- ctx
295+
- json
296+
- hash
297+
imports:
298+
google_config: wippy.llm.google:config
299+
google_mapper: wippy.llm.google:mapper
300+
method: handler
301+
302+
# wippy.llm.google:structured_output_test
303+
- name: structured_output_test
304+
kind: function.lua
305+
meta:
306+
name: Google structured output handler Unit Tests
307+
type: test
308+
comment: Unit tests for Google structured output handler
309+
group: LLM / Drivers / Google
310+
tags:
311+
- unit-test
312+
- structured-output
313+
source: file://structured_output_test.lua
314+
imports:
315+
google_structured_output: wippy.llm.google:structured_output
316+
test: wippy.test:test
317+
method: run_tests

0 commit comments

Comments
 (0)