mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
feat(ai): add AI provider types and InsightResult Zod schema
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3982cfa082
commit
f18ded4860
1 file changed
+58
@@ -0,0 +1,58 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
// ─── Insight Result Schema ─────────────────────────────────
|
||||
|
||||
export const insightFindingSchema = z.object({
|
||||
label: z.string(),
|
||||
value: z.string(),
|
||||
assessment: z.enum(["positive", "neutral", "attention", "warning"]),
|
||||
guideline: z.string().optional(),
|
||||
});
|
||||
|
||||
export const insightCorrelationSchema = z.object({
|
||||
factor: z.string(),
|
||||
effect: z.string(),
|
||||
confidence: z.enum(["hoch", "mittel", "gering"]),
|
||||
});
|
||||
|
||||
export const insightDataQualitySchema = z.object({
|
||||
coverage: z.string(),
|
||||
gaps: z.array(z.string()),
|
||||
confidence: z.enum(["hoch", "mittel", "gering"]),
|
||||
});
|
||||
|
||||
export const insightResultSchema = z.object({
|
||||
summary: z.string(),
|
||||
classification: z.enum(["optimal", "gut", "grenzwertig", "erhoht", "kritisch"]),
|
||||
findings: z.array(insightFindingSchema),
|
||||
correlations: z.array(insightCorrelationSchema),
|
||||
recommendations: z.array(z.string()),
|
||||
dataQuality: insightDataQualitySchema,
|
||||
disclaimer: z.string(),
|
||||
});
|
||||
|
||||
export type InsightResult = z.infer<typeof insightResultSchema>;
|
||||
export type InsightFinding = z.infer<typeof insightFindingSchema>;
|
||||
|
||||
// ─── Provider Types ────────────────────────────────────────
|
||||
|
||||
export type ProviderType = "codex" | "admin-key" | "none";
|
||||
|
||||
export interface AIProvider {
|
||||
type: ProviderType;
|
||||
generateCompletion(params: CompletionParams): Promise<CompletionResult>;
|
||||
}
|
||||
|
||||
export interface CompletionParams {
|
||||
systemPrompt: string;
|
||||
userPrompt: string;
|
||||
temperature?: number;
|
||||
maxTokens?: number;
|
||||
}
|
||||
|
||||
export interface CompletionResult {
|
||||
content: string;
|
||||
tokensUsed: number | null;
|
||||
model: string;
|
||||
providerType: ProviderType;
|
||||
}
|
||||
Reference in new issue
Block a user