Skip to content

Conversation

@saimahesh8752
Copy link

Description:

Adds a new example examples/financial_advisor demonstrating how to use Colang to enforce standard Fintech compliance rules (blocking insider trading queries).

Signed-off-by: saimahesh8752 <[email protected]>
Signed-off-by: saimahesh8752 <[email protected]>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

  • Adds a new examples/financial_advisor directory with Colang compliance example for blocking insider trading queries in financial applications
  • Implements flow patterns to detect and refuse both insider trading questions and general financial advice requests using standard Colang syntax
  • Includes minimal README documentation describing the example's purpose for fintech compliance scenarios

Important Files Changed

Filename Overview
examples/financial_advisor/finance.co New Colang file implementing compliance flows to detect and block insider trading queries and financial advice requests

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it only adds a new example without modifying existing functionality
  • Score reflects the simple, well-structured Colang implementation that follows established patterns, though the example patterns are quite basic and may need expansion for production use
  • The new finance.co file requires attention to ensure the user intent patterns provide adequate coverage for real-world compliance scenarios

Sequence Diagram

sequenceDiagram
    participant User
    participant API as "FastAPI Server"
    participant LLMRails as "LLMRails Engine"
    participant Runtime as "Colang Runtime"
    participant FlowEngine as "Flow Engine"
    participant LLM as "OpenAI GPT-3.5"
    
    User->>API: "POST /v1/rails/chat with message"
    API->>LLMRails: "generate_async(messages, config_id)"
    LLMRails->>Runtime: "generate_events(user_message_event)"
    
    Runtime->>FlowEngine: "compute_next_steps(events)"
    FlowEngine->>FlowEngine: "match user input against flow patterns"
    
    alt User asks about insider trading
        FlowEngine->>Runtime: "trigger insider trading protection flow"
        Runtime->>Runtime: "execute bot refuse insider trading"
        Runtime->>LLMRails: "return compliance refusal events"
        LLMRails->>API: "return blocked response message"
        API->>User: "I cannot provide insider trading tips..."
    else User asks about financial advice
        FlowEngine->>Runtime: "trigger financial advice protection flow"
        Runtime->>Runtime: "execute bot refuse financial advice"
        Runtime->>LLMRails: "return compliance refusal events"
        LLMRails->>API: "return blocked response message"
        API->>User: "I am an AI assistant, not a licensed advisor..."
    else Normal query
        Runtime->>LLM: "generate_async(user_query)"
        LLM->>Runtime: "return llm_response"
        Runtime->>FlowEngine: "check output flows"
        FlowEngine->>Runtime: "apply self check output"
        Runtime->>LLMRails: "return approved response events"
        LLMRails->>API: "return generated response"
        API->>User: "Normal AI response"
    end
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant