1public function __construct( 2 private Retriever $retriever, 3 private ChatClient $llm, 4) {} 5 6public function antwort(string $frage, Tenant $kunde): Answer { 7 // Nur Wissen DIESES Mandanten — hart gefiltert 8 $kontext = $this->retriever->search($frage, tenant: $kunde->id, k: 6); 910 // Antwort streng aus dem Kontext, mit Quellen11 return $this->llm->grounded($frage, context: $kontext)12 ->withCitations()13 ->orElse('Dazu liegt mir keine Quelle vor.');14}
1public function handle(IncomingMail $mail): void { 2 // 1. KI erkennt das Anliegen + zieht die Felder 3 $vorgang = $this->classifier->route( 4 $mail->body, labels: Anliegen::cases(), 5 ); 6 7 // 2. Sichere Fälle automatisch, Rest an den Menschen 8 match ($vorgang->confidence >= 0.9) { 9 true => $this->crm->anlegen($vorgang),10 false => $this->queue->zurPruefung($vorgang),11 };12}
1public function __construct( 2 private VisionClient $vision, 3 private InvoiceRepository $repo, 4 private DatevExporter $datev, 5) {} 6 7public function extract(UploadedFile $pdf): Invoice { 8 // 1. Vision-Modell liest Rechnung strukturiert aus 9 $data = $this->vision->parse($pdf, schema: InvoiceSchema::class);1011 // 2. Persistieren + asynchron nach DATEV exportieren12 $invoice = $this->repo->save(Invoice::from($data));13 $this->datev->queueExport($invoice);14 return $invoice;15}
1Route::post('/api/zusammenfassung', function ( 2 Request $request, Summarizer $ki 3) { 4 // KI-Feature im Produkt — pro Workspace kontingentiert 5 $request->user()->workspace->assertQuota('ai_summary'); 6 7 return $ki->fuer($request->validated()['record_id']) 8 ->ton('sachlich') 9 ->stream(); // Server-Sent Events ans Frontend10})->middleware(['auth:sanctum', 'throttle:ki']);