{"id":19156514,"url":"https://github.com/kkdai/linebot-gemma","last_synced_at":"2025-10-24T04:03:15.859Z","repository":{"id":249503778,"uuid":"831695952","full_name":"kkdai/linebot-gemma","owner":"kkdai","description":"A LINE Bot demo showcasing how to use a local LLM (Gemma) via Groq to modify personal information and detect the need for LLM assistance.","archived":false,"fork":false,"pushed_at":"2024-07-25T02:13:52.000Z","size":1806,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T20:17:08.893Z","etag":null,"topics":["gemini","gemma","linebot","python"],"latest_commit_sha":null,"homepage":"https://www.evanlin.com/gemma-local-linebot/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkdai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-07-21T11:01:47.000Z","updated_at":"2025-03-31T12:04:23.000Z","dependencies_parsed_at":"2024-11-09T08:36:21.494Z","dependency_job_id":"61b63c21-7c6a-4c2a-b3a7-f7f5bd87bb86","html_url":"https://github.com/kkdai/linebot-gemma","commit_stats":null,"previous_names":["kkdai/linebot-gemma"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkdai%2Flinebot-gemma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkdai%2Flinebot-gemma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkdai%2Flinebot-gemma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkdai%2Flinebot-gemma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkdai","download_url":"https://codeload.github.com/kkdai/linebot-gemma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252838427,"owners_count":21812069,"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","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":["gemini","gemma","linebot","python"],"created_at":"2024-11-09T08:34:48.506Z","updated_at":"2025-10-24T04:03:10.826Z","avatar_url":"https://github.com/kkdai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LINE Bot Demo for Personal Data Hider and LLM Detector\n\nThis project provides a FastAPI application that integrates with LINE Bot to hide personal data and detect if customer service assistance is needed using LLM (Large Language Models). The application leverages the Gemini Pro API and Groq for generative AI capabilities.\n\n\n\n## Demo Image\n\n![](./img/asistant_detection.jpg)\n\n![](./img/personal_info_hider.jpg)\n\n## Features\n\n- **Personal Data Hiding**: Automatically removes personal information such as names, addresses, ID numbers, and bank accounts from messages.\n- **LLM Assistance Detection**: Detects if a message requires customer service assistance and processes it accordingly.\n- **Image Description**: Describes images with scientific detail in Traditional Chinese (zh-TW).\n\n## Environment Variables\n\nEnsure the following environment variables are set:\n\n- `ChannelSecret`: Your LINE Bot channel secret.\n- `ChannelAccessToken`: Your LINE Bot channel access token.\n- `GEMINI_API_KEY`: Your Gemini Pro API key.\n- `GROQ_API_KEY`: Your Groq API key.\n\n## Installation\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/yourusername/your-repo.git\n    cd your-repo\n    ```\n\n2. Install the required dependencies:\n\n    ```sh\n    pip install -r requirements.txt\n    ```\n\n3. Set the environment variables:\n\n    ```sh\n    export ChannelSecret='your_channel_secret'\n    export ChannelAccessToken='your_channel_access_token'\n    export GEMINI_API_KEY='your_gemini_api_key'\n    export GROQ_API_KEY='your_groq_api_key'\n    ```\n\n## Usage\n\nRun the FastAPI application:\n\n```sh\nuvicorn main:app --reload\n\n```\n\n## Code Overview\n\n### Main Functionality\n\n- **Message Handling**: The application listens for incoming messages from LINE Bot and processes them based on their type (text or image).\n- **Personal Data Removal**: Uses a local LLM to remove personal information from text messages.\n- **LLM Assistance Detection**: Determines if a message requires customer service assistance and processes it using the Gemini Pro API.\n- **Image Description**: Describes images using the Gemini Pro API.\n\n### Key Functions\n\n- `generate_gemini_text_complete(prompt)`: Generates a text completion using the Gemini Pro API.\n- `generate_result_from_image(img, prompt)`: Generates a description for an image using the Gemini Pro API.\n- `generate_local_llm_result(prompt)`: Generates a result using a local LLM (Groq).\n\n## Example\n\nHere is an example of how the application processes a text message:\n\n1. A user sends a message containing personal information.\n2. The application uses the local LLM to remove personal information.\n3. The modified message is then processed by the Gemini Pro API to generate a complete response in Traditional Chinese (zh-TW).\n4. The original and modified messages are sent back to the user.\n\n## Contributing\n\nFeel free to submit issues or pull requests if you have any improvements or bug fixes.\n\n## License\n\nThis project is licensed under the MIT License.\n\n```\n\nThis `README.md` provides an overview of the project, its features, installation instructions, usage, and a brief explanation of the code. Adjust the repository URL and other details as necessary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkdai%2Flinebot-gemma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkdai%2Flinebot-gemma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkdai%2Flinebot-gemma/lists"}