-
Notifications
You must be signed in to change notification settings - Fork 3.1k
v0.4.12: guardrails, mistral models, privacy policy updates #1608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…dex on snapshot id (#1603)
* updated privacy policy for google * update terms, privacy, and emails to incl address and update verbiage
* Adding guardrails block * ack PR comments * cleanup checkbox in dark mode * cleanup * fix supabase tools
… API, add drag-and-drop functionality to deployed chat (#1606) * fix(inference): fix inference billing when stream is true via API * add drag-and-drop to deployed chat
* feat(mistal): added mistral as a provider, updated model prices * remove the ability for a block to reference its own outluts * fixed order of responses for guardrails block
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This release bundles 6 separate PRs into v0.4.12, introducing guardrails for content validation, Mistral AI provider support, performance improvements, and UX enhancements.
Major Changes:
- Guardrails Feature (#1605): Added comprehensive content validation system with JSON validation, regex pattern matching, RAG-based hallucination detection using knowledge bases, and PII detection/masking using Microsoft Presidio
- Mistral AI Provider (#1607): Integrated Mistral AI as a new LLM provider with streaming support, tool calling, and updated pricing for all models across providers
- Inference Billing Fix (#1606): Resolved critical billing bug where streaming API executions weren't properly tracked; now defers logging completion until after token counting
- Drag-and-Drop Files (#1606): Enhanced deployed chat interface with drag-and-drop file upload capability
- Performance Optimization (#1603): Removed unused database indexes on
workflow_edges(source/target blocks) and added index onstate_snapshot_idfor faster execution log queries - Blog Path Redirect (#1604): Added permanent redirect from
/building/*to/blog/*for backward compatibility - Privacy Policy Update (#1602): Updated privacy policy for additional Google OAuth scopes
Key Implementation Details:
- Guardrails block uses Python subprocess for PII detection via Presidio, with proper error handling and JSON parsing
- Hallucination detection queries knowledge bases via internal API and uses LLM to score confidence (0-10 scale)
- Mistral provider uses OpenAI SDK with custom base URL for API compatibility
- Streaming billing fix adds
skipLoggingCompleteflag and_streamingMetadatato defer cost calculation
Confidence Score: 5/5
- This PR is safe to merge with high confidence
- All changes are well-implemented with no critical issues found. The PR bundles multiple tested PRs (#1603-1607) that were already reviewed individually. Code follows established patterns, includes proper error handling, and the billing fix addresses a real production issue. Database migrations are minimal and safe (index changes only).
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/db/migrations/0098_thick_prima.sql | 5/5 | Removed unused source/target block indexes and added index on state_snapshot_id for performance optimization |
| apps/sim/blocks/blocks/guardrails.ts | 5/5 | Added comprehensive guardrails block with JSON, regex, hallucination, and PII validation types |
| apps/sim/lib/guardrails/validate_pii.py | 5/5 | Implemented PII detection using Presidio library with block/mask modes and multi-language support |
| apps/sim/lib/guardrails/validate_hallucination.ts | 5/5 | Implemented RAG-based hallucination detection with knowledge base retrieval and LLM confidence scoring |
| apps/sim/providers/mistral/index.ts | 5/5 | Added Mistral AI provider with OpenAI-compatible API client, streaming support, and tool calling |
| apps/sim/lib/workflows/streaming.ts | 5/5 | Fixed streaming workflow billing by deferring logging completion until after token counting |
| apps/sim/app/api/workflows/[id]/execute/route.ts | 5/5 | Added skipLoggingComplete option to support deferred billing in streaming workflows |
Sequence Diagram
sequenceDiagram
participant Client
participant API
participant Executor
participant Guardrails
participant KB as Knowledge Base
participant LLM
participant Presidio as PII Detection
participant Billing
Client->>API: POST /api/workflows/[id]/execute
API->>Executor: executeWorkflow(stream: true)
alt Guardrails Block
Executor->>Guardrails: Validate content
alt Hallucination Check
Guardrails->>KB: Query knowledge base (RAG)
KB-->>Guardrails: Return chunks
Guardrails->>LLM: Score confidence (0-10)
LLM-->>Guardrails: Score + reasoning
else PII Detection
Guardrails->>Presidio: Analyze text
Presidio-->>Guardrails: Detected entities
alt Block Mode
Guardrails-->>Executor: Validation failed
else Mask Mode
Guardrails-->>Executor: Masked text
end
end
end
Executor->>LLM: Execute workflow (stream)
LLM-->>Executor: Stream response
Executor-->>API: Stream chunks
Note over Executor,Billing: Streaming Fix: Defer logging completion
Executor->>Executor: Build trace spans with costs
Executor->>Billing: Complete logging session
API-->>Client: Return response
59 files reviewed, no comments
…1611) * fix(vulns): fix SSRF vulnerabilities * cleanup * cleanup * regen docs * remove unused deps * fix failing tests * cleanup * update deps * regen bun lock
Uh oh!
There was an error while loading. Please reload this page.