{"id":25552512,"url":"https://github.com/stackloklabs/spring-ai-codegate-sample","last_synced_at":"2025-10-07T02:29:42.685Z","repository":{"id":274376094,"uuid":"922706182","full_name":"StacklokLabs/spring-ai-codegate-sample","owner":"StacklokLabs","description":"Experimental application that integrates Spring AI and CodeGate","archived":false,"fork":false,"pushed_at":"2025-02-17T22:52:19.000Z","size":771,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-30T22:12:20.124Z","etag":null,"topics":["ai-gateway","ai-proxy","java","mermaid-diagrams","open-ai","privacy","sample-app","spring-ai","springboot"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StacklokLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-26T22:08:26.000Z","updated_at":"2025-03-27T08:28:32.000Z","dependencies_parsed_at":"2025-05-23T18:16:17.401Z","dependency_job_id":"8520de9e-e7ba-446b-9615-cb7eb9365ec4","html_url":"https://github.com/StacklokLabs/spring-ai-codegate-sample","commit_stats":null,"previous_names":["stackloklabs/spring-ai-codegate-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StacklokLabs/spring-ai-codegate-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StacklokLabs%2Fspring-ai-codegate-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StacklokLabs%2Fspring-ai-codegate-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StacklokLabs%2Fspring-ai-codegate-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StacklokLabs%2Fspring-ai-codegate-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StacklokLabs","download_url":"https://codeload.github.com/StacklokLabs/spring-ai-codegate-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StacklokLabs%2Fspring-ai-codegate-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708382,"owners_count":26032004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-gateway","ai-proxy","java","mermaid-diagrams","open-ai","privacy","sample-app","spring-ai","springboot"],"created_at":"2025-02-20T11:25:14.428Z","updated_at":"2025-10-07T02:29:42.660Z","avatar_url":"https://github.com/StacklokLabs.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n---\n# ✨ Spring AI app with AI Privacy Gateway via CodeGate\nThis project is an expiremental application that integrates [Spring AI](https://spring.io/projects/spring-ai) and [Codegate](https://github.com/stacklok/codegate) (transparent AI gateway providing personally identifiable information (PII) protection). Spring Boot-based chat application leverages OpenAI's API for generating responses to user prompts while CodeGate ensures senstive information (e.g. email address, credit cards) aren't sent to OpenAI. \n\nAdditional Learning Resources:\n - CodeGate Resources:\n[GitHub Repository](https://github.com/stacklok/codegate) | [Documentation](https://docs.codegate.ai) |\n[YouTube](https://www.youtube.com/playlist?list=PLYBL38zBWVIhrDgKwAMjAwOYZeP-ZH64n)\n| [Discord](https://discord.gg/stacklok)\n\n - Spring AI Resources:\n[GitHub Repository](https://github.com/spring-projects/spring-ai) | [Documentation](https://docs.spring.io/spring-ai/reference/)\n\n---\n## Functionality Summary\n- **Interactive Chat**: Users can input questions or commands via the console and receive formatted responses from an AI assistant.\n- **OpenAI Integration**: Utilizes OpenAI's GPT-4 models for generating high-quality answers through a Spring Boot service layer.\n- **Privacy Focus**: The application is designed to operate with a strong emphasis on user privacy and data security leveraging CodeGate.\n---\n\n## Application Flow \n\n```mermaid\nsequenceDiagram\n    participant U as User\n    participant A as Application\n    participant O as OpenAIService\n    participant C as ChatClient\n    participant G as CodeGate\n    participant AI as OpenAI\n\n    U-\u003e\u003eA: Start CLI interaction\n    A-\u003e\u003eU: Prompt for input\n    U-\u003e\u003eA: User enters question\n    A-\u003e\u003eO: getAnswer(question)\n    O-\u003e\u003eC: chatClient.prompt().user(question)\n    C-\u003e\u003eG: Call OpenAI API via CodeGate.privacyCheck()\n    G-\u003e\u003eAI: Call OpenAI API\n    AI--\u003e\u003eG: Response from OpenAI\n    G--\u003e\u003eC: Response from OpenAI\n    C--\u003e\u003eO: Return response to ChatClient\n    O--\u003e\u003eA: Return response to Application\n    A--\u003e\u003eU: Display response to User\n```\n---\n# Getting Started\n\nFollow these steps to clone and run this project locally:\n\n## Prerequisites\n\n- Java 17 or higher\n- Maven \n- An OpenAI API key\n- CodeGate is distributed as a Docker container. You need a container runtime like\nDocker Desktop or Docker Engine. Podman and Podman Desktop are also supported.\nCodeGate works on Windows, macOS, and Linux operating systems with x86_64 and\narm64 (ARM and Apple Silicon) CPU architectures.\n\n## Clone the repository\n\n```bash\ngit clone https://github.com/StacklokLabs/spring-ai-codegate-sample.git\ncd sample\n```\n\n## Setup Configuration\n\n1. Create a file named `application.properties` in the `src/main/resources` directory, and add your OpenAI API key:\n\n```\nspring.ai.openai.api-key=YOUR_OPENAI_API_KEY\n```\n\n## Build the Project\n\nRun the following command to build the project:\n\n```bash\nmvn clean install\n```\n\n## Install CodeGate\n\nFollow the instructions in [CodeGate's Quickstart documentation](https://github.com/stacklok/codegate?tab=readme-ov-file#-quickstart)\n\n### Installation\n\nTo start CodeGate, run this simple command:\n\n```bash\ndocker run --name codegate -d -p 8989:8989 -p 9090:9090 -p 8990:8990 \\\n  --mount type=volume,src=codegate_volume,dst=/app/codegate_volume \\\n  --restart unless-stopped ghcr.io/stacklok/codegate:latest\n```\n\nThat’s it! CodeGate is now running locally. \n\n\n\n## Run the CLI Application\n\nYou can run the application using the command:\n\n```bash\nmvn spring-boot:run\n```\nWhen prompted by the CLI, type \n```bash\ncodegate version\n```\nIf CodeGate is configured properly, you should receive the following response: \n```bash\nAssistant: CodeGate version: v0.1.18\n```\nNote: You will need to be running CodeGate version v0.1.18 or greater to leverage the PII feature.\n\nTo see the privacy feature in action. attempt to send an email address and watch CodeGate redact the email address before sending the request to OpenAI:\n```bash\n Who is test.sender@example.com\n```\nCodeGate will intercept the request and redact the email address and will only send a UUID to OpenAI. You should receive the following response:\n```bash\nAssistant: I'm sorry, but I can't provide information about specific UUIDs..\n```\n\n \n\n## Contribute\n\nFeel free to fork the repository, make improvements or report issues.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackloklabs%2Fspring-ai-codegate-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackloklabs%2Fspring-ai-codegate-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackloklabs%2Fspring-ai-codegate-sample/lists"}