{"id":22640408,"url":"https://github.com/Snowflake-Labs/Snowflake-AI-Toolkit","last_synced_at":"2025-10-18T14:31:42.664Z","repository":{"id":267066687,"uuid":"900175938","full_name":"Snowflake-Labs/Snowflake-AI-Toolkit","owner":"Snowflake-Labs","description":"Snowflake AI Toolkit is an AI Accelerator and Playground for enabling AI in Snowflake. It is an Plug and Play Streamlit based Native App that can be used to explore, learn and build rapid prototypes of AI Solutions in Snowflake powered by the Snowflake's Cortex and AI Functions. ","archived":false,"fork":false,"pushed_at":"2025-01-29T19:36:41.000Z","size":21627,"stargazers_count":102,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T20:34:10.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/Snowflake-Labs.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}},"created_at":"2024-12-08T04:07:51.000Z","updated_at":"2025-01-29T19:36:45.000Z","dependencies_parsed_at":"2024-12-08T05:17:39.693Z","dependency_job_id":"2fa8ead0-e039-4c44-83cb-6d3ce9ade4f8","html_url":"https://github.com/Snowflake-Labs/Snowflake-AI-Toolkit","commit_stats":null,"previous_names":["sgsshankar/snowflake-ai-toolkit","snowcatalyst/snowflake-ai-toolkit","snowflake-labs/snowflake-ai-toolkit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2FSnowflake-AI-Toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2FSnowflake-AI-Toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2FSnowflake-AI-Toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2FSnowflake-AI-Toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snowflake-Labs","download_url":"https://codeload.github.com/Snowflake-Labs/Snowflake-AI-Toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236971463,"owners_count":19234516,"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":[],"created_at":"2024-12-09T04:10:19.183Z","updated_at":"2025-10-18T14:31:42.652Z","avatar_url":"https://github.com/Snowflake-Labs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snowflake AI Toolkit\n\nSnowflake AI Toolkit is an AI Accelerator and Playground for enabling AI in Snowflake. It is a Plug and Play Streamlit-based Native App that lets you explore, learn, and rapidly prototype AI solutions powered by Snowflake's Cortex and AI Functions. In addition to these capabilities, the toolkit automatically sets up your environment and provides prebuilt use cases to try all Cortex features—from simple prompting to advanced agentic solutions.\n\n# Features\n\n### Playground\n\nAn interactive environment where users can chat and experiment with Snowflake Cortex functions, test prompts, and explore Cortex capabilities. Supports both manual text entry and voice-to-text input for prompts across multiple functions—including Complete, Translate, Extract, Sentiment Analysis, and AI Complete (debug mode only). Additionally, audio output is available for responses, enabling users to listen to results as well as view them.\n\n### Build\n\nA dedicated section for constructing and deploying data pipelines and workflows using Snowflake Cortex's powerful AI capabilities, enabling seamless integration with your Snowflake databases and tables\n\n- Text completion and generation using the COMPLETE function\n- Retrieval-Augmented Generation (RAG) for question answering with your own data\n- Fine-tuning large language models on your custom datasets\n\n### Search\n\nGet a hybrid (vector and keyword) search engine on your text data in minutes,\n\n- Create and manage Cortex Search Service\n- Use Cortex Search for your RAG Application\n- Use Cortex Search Powered Chat\n\n### Agent\n\nCortex Agents orchestrate across both structured and unstructured data sources to deliver insights.\n\n- Create and Manage Cortex Agent Instances\n- Test the Agent against the Data\n- Utilize Cortex Search and Cortex Analyst through Agents\n\n### Audio Input Integration\n\nThe Snowflake AI Toolkit now supports voice input across multiple functionalities, making it easier to interact with AI functions through speech (available in debug mode only):\n\n- **Voice-to-Text Conversion**: Convert spoken words directly into text inputs for various AI functions\n- **Multi-Function Support**: Available for Complete, Complete Multimodal, Translate, Extract, Sentiment Analysis, AI Classify (Image), and AI Complete functions\n- **Real-Time Processing**: Instant speech recognition with immediate text population in input fields\n- **User-Friendly Interface**: Microphone button (🎙️) positioned conveniently next to the Run button for seamless workflow\n- **Debug Mode Only**: Audio input feature is enabled only when `mode` is set to `\"debug\"` in `src/settings_config.json`\n\n### Notification\n\n- **Real-Time Updates**: Receive instant notifications for every function call and completion.\n- **Synchronous \u0026 Asynchronous Support**: Stay informed about both immediate and long-running processes, including RAG and fine-tuning tasks.\n- **Computation Details**: View token usage and token credit consumption for each operation.\n- **In-App Delivery**: All notifications appear directly within the application interface.\n- **Enhanced Transparency**: Get clear, timely feedback throughout all workflows.\n\n\n## Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n- **Snowflake Account**: Ensure you have an active Snowflake account in a region where Cortex functionalities are supported. For detailed information, refer to the [Availability Region documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions#availability).\n- **Private Preview Access**: To try private preview models in Snowflake, you need to contact your Snowflake account team to request access to the private preview feature.\n- **Role Permissions**: ACCOUNTADMIN or equivalent role with permissions to create:\n  - Stages\n  - Databases\n  - Other resources\n- **Python**: Version 3.7 or higher.\n- **Streamlit**: Installed on your local machine.\n- **Snowflake-CLI** : Install snowflake-cli through pip\n- **Model Availability**: `claude-4-sonnet` and `claude-4-opus` is available only in AWS US (cross-region).\n\n## Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/sgsshankar/Snowflake-AI-Toolkit.git\n   cd snowflake-ai-toolkit\n   ```\n\n2. Install dependencies (only required for local development):\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n   All necessary libraries are listed in `requirements.txt`.\n\n## Setup\n\nThe application will automatically handle:\n\n- Database creation\n- Stage setup\n- Required resource initialization\n\nMake sure your Snowflake role has the necessary privileges for these operations.\n\nTo configure the application mode, update the `mode` parameter in `src/settings_config.json`:\n\n- Set to `\"debug\"` for local development and editing.\n- Set to `\"native\"` for running natively in Snowflake.\n\n### Authentication for Cortex Agent – JWT Token Support Only\n\nThis app currently supports **only JWT-based authentication** using RSA key pairs for Cortex Agents. OAuth is **not supported** at this time.\n\n#### Step 1: Generate RSA Key Pair\n\n```bash\nopenssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_private_key.p8 -nocrypt\nopenssl rsa -in rsa_private_key.p8 -pubout -out rsa_public_key.pub\n```\n\n#### Step 2: Upload Public Key to Snowflake\n\n1. Copy the content from `rsa_public_key.pub` (exclude `-----BEGIN PUBLIC KEY-----` headers).\n2. In Snowflake, run:\n\n```sql\nalter user \u003cyour_username\u003e set rsa_public_key='\u003cpaste_public_key_here\u003e';\n```\n\n3. Retrieve the public key fingerprint:\n\n```sql\ndesc user \u003cyour_username\u003e;\n```\n\nUse the fingerprint in `rsa_public_key_fp`.\n\n#### Step 3: Add to `settings_config.json`\n\n- Paste full contents of `rsa_private_key.p8` into `rsa_private_key` (add \\n).\n- Paste fingerprint into `rsa_public_key_fp`.\n\nFor more details, refer to the [Snowflake documentation](https://docs.snowflake.com/en/user-guide/key-pair-auth.html#using-key-pair-authentication).\n\n## Running the App\n\n### Locally\n\nLaunch the application locally using:\n\n```bash\nstreamlit run streamlit_app.py\n```\n\n### Natively on Snowflake\n\nTo deploy the application natively in Snowflake, use the following command:\n\n```bash\nsnow streamlit deploy --account \"\u003cyour_account\u003e\" --user \"\u003cyour_username\u003e\" --password \"\u003cyour_password\u003e\" --role \"\u003cyour_role\u003e\" --warehouse \"\u003cyour_warehouse\u003e\" --database \"\u003cyour_database\u003e\" --replace\n```\n\nReplace the placeholders (`\u003cyour_account\u003e`, `\u003cyour_username\u003e`, etc.) with your actual Snowflake account details. When running natively in Snowflake, installing dependencies from `requirements.txt` is not needed.\n\n## Project Structure\n\n| File/Directory                                             | Description                          |\n| ---------------------------------------------------------- | ------------------------------------ |\n| [src/](src/)                                               | Source code for setup and styling    |\n| [src/setup.py](src/setup.py)                               | Setup and initialization code        |\n| [src/styles.css](src/styles.css)                           | Custom styling                       |\n| [src/build.py](src/build.py)                               | Build mode functionality             |\n| [src/cortex_functions.py](src/cortex_functions.py)         | Core functions for Cortex operations |\n| [src/query_result_builder.py](src/query_result_builder.py) | Query result handling and display    |\n| [src/playground.py](src/playground.py)                     | Playground mode functionality        |\n| [src/rag.py](src/rag.py)                                   | RAG mode functionality               |\n| [src/fine_tune.py](src/fine_tune.py)                       | Fine-tuning functionality            |\n| [src/search.py](src/search.py)                             | Cortex Search Functionality          |\n| [.gitignore](.gitignore)                                   | Git ignore file                      |\n| [requirements.txt](requirements.txt)                       | Project dependencies                 |\n| [streamlit_app.py](streamlit_app.py)                       | Main application entry point         |\n\n## Troubleshooting\n\nCommon issues and solutions:\n\n1. **Snowflake Permission Errors**\n\n   - Verify role privileges for database and stage creation\n   - Ensure Cortex functionalities are enabled\n\n2. **Dependency Issues**\n\n   - If pandas/pyarrow installation fails:\n     ```bash\n     pip install pandas pyarrow\n     ```\n\n3. **Connection Issues**\n   - Verify Snowflake account credentials\n   - Check network connectivity\n   - Ensure proper role assignments\n\n## Contributing\n\nWe welcome contributions! Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Submit a pull request\n\n## Support\n\nFor assistance:\n\n- Open an issue in the GitHub repository\n- Contact project maintainers\n- Check documentation for common solutions\n\n## Warranty\n\nThe Software is provided as Open Source. This software is provided “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.\n\n## Legal\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this tool except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nThis is an Open Source repository and not an official Snowflake offering. This tool is not endorsed by Snowflake or any of the previous or current employers of the developers.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. SNOWFLAKE is a trademark of Snowflake Computing, Inc in the United States and/or other countries. Any use of third-party trademarks or logos are subject to those third-party's policies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnowflake-Labs%2FSnowflake-AI-Toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSnowflake-Labs%2FSnowflake-AI-Toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnowflake-Labs%2FSnowflake-AI-Toolkit/lists"}