{"id":29721101,"url":"https://github.com/openmined/syft-nsai","last_synced_at":"2026-04-02T18:43:24.365Z","repository":{"id":302544673,"uuid":"1010411194","full_name":"OpenMined/syft-nsai","owner":"OpenMined","description":"Network-source AI","archived":false,"fork":false,"pushed_at":"2025-06-29T02:31:51.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-28T01:52:25.466Z","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/OpenMined.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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},"funding":{"github":"openmined"}},"created_at":"2025-06-29T02:31:50.000Z","updated_at":"2025-07-15T20:11:07.000Z","dependencies_parsed_at":"2025-07-03T00:35:42.673Z","dependency_job_id":"cbc1a3a4-bd29-46b8-8767-9a10b7038e0f","html_url":"https://github.com/OpenMined/syft-nsai","commit_stats":null,"previous_names":["openmined/syft-nsai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OpenMined/syft-nsai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenMined%2Fsyft-nsai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenMined%2Fsyft-nsai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenMined%2Fsyft-nsai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenMined%2Fsyft-nsai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenMined","download_url":"https://codeload.github.com/OpenMined/syft-nsai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenMined%2Fsyft-nsai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-07-24T14:18:56.196Z","updated_at":"2026-04-02T18:43:24.348Z","avatar_url":"https://github.com/OpenMined.png","language":"Python","funding_links":["https://github.com/sponsors/openmined"],"categories":[],"sub_categories":[],"readme":"# syft-nsai\n\n**Bridge Data and AI. Privately.**\n\nAn OpenAI-compatible interface for using SyftBox datasets with AI models in secure enclaves.\n\n## 🚀 What is syft-nsai?\n\n`syft-nsai` transforms how you work with federated datasets by providing a familiar OpenAI-style chat completions API that operates within secure enclaves. No more complex setup or unfamiliar APIs - just select your datasets and chat with your data.\n\n```python\nimport syft_datasets as syd\nimport syft_nsai as nsai\n\n# Discover datasets with beautiful interactive UI\nsyd.datasets\n\n# Use them with familiar OpenAI-style API\nselected_datasets = [syd.datasets[i] for i in [0, 1, 5]]\nresponse = nsai.client.chat.completions.create(\n    model=selected_datasets,  # Your datasets become the \"model\"\n    messages=[{\"role\": \"user\", \"content\": \"What trends do you see in this data?\"}]\n)\n\n# Access results\nprint(response.choices[0].message.content)\n```\n\n## ✨ Key Features\n\n- **🔒 Privacy-First**: All processing happens in secure enclaves\n- **🤝 OpenAI Compatible**: Drop-in replacement for familiar chat completions API\n- **📊 Real Data Integration**: Datasets are loaded and summarized before AI analysis\n- **⚡ Lazy Loading**: Results are fetched asynchronously for better UX\n- **🔄 Seamless Integration**: Works perfectly with `syft-datasets` for dataset discovery\n\n## 🏗️ Architecture\n\n```\n┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐\n│  syft-datasets  │    │   syft-nsai      │    │  Secure Enclave │\n│                 │    │                  │    │                 │\n│ Dataset Discovery│───▶│OpenAI-style API  │───▶│  AI Processing  │\n│ Interactive UI   │    │Chat Completions  │    │  with Real Data │\n│ Search \u0026 Select  │    │Async Results     │    │                 │\n└─────────────────┘    └──────────────────┘    └─────────────────┘\n```\n\n## 📦 Installation\n\n```bash\npip install syft-nsai\n```\n\nFor development:\n```bash\npip install syft-nsai[dev]\n```\n\n## 🚀 Quick Start\n\n### 1. Discover Datasets\n\nFirst, use `syft-datasets` to explore available datasets:\n\n```python\nimport syft_datasets as syd\n\n# Show interactive dataset browser\nsyd.datasets\n```\n\n### 2. Select and Analyze\n\nUse the selected datasets with the OpenAI-compatible API:\n\n```python\nimport syft_nsai as nsai\n\n# Select datasets (from the interactive UI or programmatically)\nmy_datasets = [syd.datasets[0], syd.datasets[3]]\n\n# Create chat completion\nresponse = nsai.client.chat.completions.create(\n    model=my_datasets,\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a data analyst.\"},\n        {\"role\": \"user\", \"content\": \"Summarize the key insights from this data.\"}\n    ]\n)\n\n# Results are loaded lazily when accessed\ninsights = response.choices[0].message.content\nprint(insights)\n```\n\n### 3. Advanced Usage\n\n```python\n# Multiple datasets for cross-analysis\ncrop_data = syd.datasets.search(\"crop\")[0]\nweather_data = syd.datasets.search(\"weather\")[0]\n\nresponse = nsai.client.chat.completions.create(\n    model=[crop_data, weather_data],\n    messages=[{\n        \"role\": \"user\", \n        \"content\": \"Analyze the correlation between weather patterns and crop yields.\"\n    }]\n)\n```\n\n## 🔧 How It Works\n\n1. **Dataset Integration**: Selected datasets are loaded and analyzed within the enclave\n2. **Context Enhancement**: Your prompts are enhanced with actual dataset summaries and sample data  \n3. **Secure Processing**: AI analysis happens in a privacy-preserving enclave using Tinfoil API\n4. **Familiar Interface**: Results are returned through OpenAI-compatible response objects\n\n## 🔗 Integration with SyftBox Ecosystem\n\n`syft-nsai` is part of the broader SyftBox ecosystem:\n\n- **syft-datasets**: Dataset discovery and management\n- **syft-core**: Core SyftBox functionality  \n- **syftbox-enclave**: Secure enclave execution\n- **syft-rds**: Remote data science capabilities\n\n## 📚 API Reference\n\n### Client\n\n```python\nimport syft_nsai as nsai\n\n# Global client instance\nclient = nsai.client\n```\n\n### Chat Completions\n\n```python\nresponse = nsai.client.chat.completions.create(\n    model=datasets_list,        # List of Dataset objects\n    messages=messages_list,     # OpenAI-style messages\n    **kwargs                    # Additional parameters\n)\n```\n\n### Response Objects\n\n```python\n# ChatCompletion\nresponse.choices              # List of Choice objects\n\n# Choice  \nchoice = response.choices[0]\nchoice.message                # Message object\n\n# Message\nmessage = choice.message\nmessage.content               # Actual AI response (lazy loaded)\n```\n\n## 🧪 Development\n\n### Setup\n\n```bash\ngit clone https://github.com/OpenMined/syft-nsai\ncd syft-nsai\nuv sync\n```\n\n### Testing\n\n```bash\nuv run pytest\n```\n\n### Linting\n\n```bash\nuv run ruff check .\nuv run ruff format .\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## 📄 License\n\nLicensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.\n\n## 🙏 Acknowledgments\n\nBuilt with ❤️ by the OpenMined community. Special thanks to:\n- The Tinfoil team for secure AI infrastructure\n- SyftBox contributors for the federated data ecosystem\n- The broader privacy-preserving ML community\n\n---\n\n**Transform your data science workflow. Privately and securely.**\n\n[Get Started →](https://github.com/OpenMined/syft-nsai#quick-start) | [Documentation →](https://github.com/OpenMined/syft-nsai#api-reference) | [Examples →](./examples/) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmined%2Fsyft-nsai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenmined%2Fsyft-nsai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmined%2Fsyft-nsai/lists"}