Skip to content

Commit b6c5366

Browse files
gHashTagclaude
andcommitted
feat: OSS API client for hybrid IGLA + LLM integration
- specs/tri/oss_api_client.vibee: Specification for hybrid client - src/vibeec/oss_api_client.zig: Native Zig implementation Features: - Groq, OpenAI, GPT-OSS-120B compatible endpoints - Coherence verification (detects garbage output) - IGLA symbolic planning integration - φ² + 1/φ² = 3 Trinity identity verification Tests: 9/9 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 83029a7 commit b6c5366

2 files changed

Lines changed: 435 additions & 0 deletions

File tree

specs/tri/oss_api_client.vibee

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: oss_api_client
2+
version: "1.0.0"
3+
language: zig
4+
module: oss_api_client
5+
6+
description: |
7+
Hybrid OSS API Client for external LLM integration.
8+
Supports: Groq, OpenAI, OSS-compatible endpoints.
9+
Combines with IGLA symbolic reasoning for hybrid inference.
10+
11+
Architecture:
12+
- IGLA: Symbolic planning, φ-math, precision tasks
13+
- OSS API: Fluent generation, natural language
14+
- Hybrid: Plan with IGLA, generate with OSS
15+
16+
constants:
17+
PHI: 1.618033988749895
18+
PHOENIX: 999
19+
MAX_TOKENS: 4096
20+
DEFAULT_TEMPERATURE: 0.7
21+
22+
types:
23+
ApiProvider:
24+
enum:
25+
- Groq
26+
- OpenAI
27+
- Custom
28+
29+
ApiConfig:
30+
fields:
31+
provider: ApiProvider
32+
api_key: String
33+
base_url: String
34+
model: String
35+
timeout_ms: Int
36+
37+
Message:
38+
fields:
39+
role: String
40+
content: String
41+
42+
ChatRequest:
43+
fields:
44+
messages: List<Message>
45+
max_tokens: Int
46+
temperature: Float
47+
stream: Bool
48+
49+
ChatResponse:
50+
fields:
51+
content: String
52+
tokens_used: Int
53+
model: String
54+
finish_reason: String
55+
56+
HybridRequest:
57+
fields:
58+
task: String
59+
use_igla_planning: Bool
60+
use_oss_generation: Bool
61+
phi_precision: Bool
62+
63+
HybridResponse:
64+
fields:
65+
igla_plan: Option<String>
66+
oss_output: String
67+
combined_result: String
68+
coherent: Bool
69+
70+
behaviors:
71+
- name: init_client
72+
given: ApiConfig with provider and credentials
73+
when: Client initialization requested
74+
then: Return configured OssApiClient ready for requests
75+
76+
- name: chat_completion
77+
given: ChatRequest with messages and params
78+
when: Completion requested
79+
then: Return ChatResponse with generated content
80+
81+
- name: stream_completion
82+
given: ChatRequest with stream=true
83+
when: Streaming completion requested
84+
then: Yield tokens as they are generated
85+
86+
- name: hybrid_inference
87+
given: HybridRequest with task description
88+
when: Hybrid IGLA+OSS inference requested
89+
then: |
90+
1. If use_igla_planning: Generate symbolic plan
91+
2. If phi_precision: Apply φ-math constraints
92+
3. If use_oss_generation: Generate fluent response
93+
4. Return HybridResponse with combined result
94+
95+
- name: verify_coherence
96+
given: Generated text output
97+
when: Coherence check requested
98+
then: Return true if output is coherent (not garbage)
99+
100+
- name: calculate_phi_identity
101+
given: No input
102+
when: Trinity identity verification
103+
then: Return φ² + 1/φ² = 3.0 (exact)
104+
105+
endpoints:
106+
groq:
107+
base_url: "https://api.groq.com/openai/v1"
108+
models:
109+
- llama-3.3-70b-versatile
110+
- mixtral-8x7b-32768
111+
- gemma2-9b-it
112+
113+
openai:
114+
base_url: "https://api.openai.com/v1"
115+
models:
116+
- gpt-4o
117+
- gpt-4o-mini
118+
- o4-mini
119+
120+
custom:
121+
base_url: "{user_defined}"
122+
models:
123+
- gpt-oss-120b
124+
- any-compatible
125+
126+
test_cases:
127+
- name: test_phi_identity
128+
input: {}
129+
expected: 3.0
130+
tolerance: 0.0001
131+
132+
- name: test_groq_coherence
133+
input:
134+
prompt: "prove φ² + 1/φ² = 3"
135+
expected_contains:
136+
- "φ"
137+
- "3"
138+
- "golden ratio"
139+
140+
- name: test_hybrid_planning
141+
input:
142+
task: "solve 2+2 step by step"
143+
use_igla_planning: true
144+
use_oss_generation: true
145+
expected_steps:
146+
- "Step 1"
147+
- "Step 2"
148+
- "Answer: 4"
149+
150+
sacred_formula: "φ² + 1/φ² = 3 | KOSCHEI IS IMMORTAL"

0 commit comments

Comments
 (0)