edgequake-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. edgequake_sdk-0.1.0/.github/workflows/test.yml +68 -0
  2. edgequake_sdk-0.1.0/.gitignore +26 -0
  3. edgequake_sdk-0.1.0/CHANGELOG.md +47 -0
  4. edgequake_sdk-0.1.0/LICENSE +189 -0
  5. edgequake_sdk-0.1.0/PKG-INFO +319 -0
  6. edgequake_sdk-0.1.0/README.md +282 -0
  7. edgequake_sdk-0.1.0/docs/API.md +556 -0
  8. edgequake_sdk-0.1.0/docs/AUTHENTICATION.md +444 -0
  9. edgequake_sdk-0.1.0/docs/STREAMING.md +506 -0
  10. edgequake_sdk-0.1.0/edgequake/__init__.py +62 -0
  11. edgequake_sdk-0.1.0/edgequake/_client.py +478 -0
  12. edgequake_sdk-0.1.0/edgequake/_compat.py +17 -0
  13. edgequake_sdk-0.1.0/edgequake/_config.py +90 -0
  14. edgequake_sdk-0.1.0/edgequake/_errors.py +208 -0
  15. edgequake_sdk-0.1.0/edgequake/_pagination.py +153 -0
  16. edgequake_sdk-0.1.0/edgequake/_streaming.py +172 -0
  17. edgequake_sdk-0.1.0/edgequake/_transport.py +400 -0
  18. edgequake_sdk-0.1.0/edgequake/py.typed +0 -0
  19. edgequake_sdk-0.1.0/edgequake/resources/__init__.py +114 -0
  20. edgequake_sdk-0.1.0/edgequake/resources/_base.py +265 -0
  21. edgequake_sdk-0.1.0/edgequake/resources/auth.py +315 -0
  22. edgequake_sdk-0.1.0/edgequake/resources/chat.py +175 -0
  23. edgequake_sdk-0.1.0/edgequake/resources/conversations.py +371 -0
  24. edgequake_sdk-0.1.0/edgequake/resources/documents.py +574 -0
  25. edgequake_sdk-0.1.0/edgequake/resources/graph.py +526 -0
  26. edgequake_sdk-0.1.0/edgequake/resources/operations.py +668 -0
  27. edgequake_sdk-0.1.0/edgequake/resources/query.py +111 -0
  28. edgequake_sdk-0.1.0/edgequake/types/__init__.py +15 -0
  29. edgequake_sdk-0.1.0/edgequake/types/auth.py +109 -0
  30. edgequake_sdk-0.1.0/edgequake/types/chat.py +114 -0
  31. edgequake_sdk-0.1.0/edgequake/types/conversations.py +168 -0
  32. edgequake_sdk-0.1.0/edgequake/types/documents.py +253 -0
  33. edgequake_sdk-0.1.0/edgequake/types/graph.py +215 -0
  34. edgequake_sdk-0.1.0/edgequake/types/operations.py +390 -0
  35. edgequake_sdk-0.1.0/edgequake/types/query.py +81 -0
  36. edgequake_sdk-0.1.0/edgequake/types/shared.py +40 -0
  37. edgequake_sdk-0.1.0/edgequake/types/workspaces.py +89 -0
  38. edgequake_sdk-0.1.0/examples/README.md +235 -0
  39. edgequake_sdk-0.1.0/examples/basic_usage.py +54 -0
  40. edgequake_sdk-0.1.0/examples/configuration.py +138 -0
  41. edgequake_sdk-0.1.0/examples/document_upload.py +93 -0
  42. edgequake_sdk-0.1.0/examples/error_handling.py +119 -0
  43. edgequake_sdk-0.1.0/examples/graph_exploration.py +87 -0
  44. edgequake_sdk-0.1.0/examples/multi_tenant.py +99 -0
  45. edgequake_sdk-0.1.0/examples/query_demo.py +67 -0
  46. edgequake_sdk-0.1.0/examples/streaming_query.py +77 -0
  47. edgequake_sdk-0.1.0/pyproject.toml +81 -0
  48. edgequake_sdk-0.1.0/tests/conftest.py +42 -0
  49. edgequake_sdk-0.1.0/tests/test_client.py +95 -0
  50. edgequake_sdk-0.1.0/tests/test_config.py +116 -0
  51. edgequake_sdk-0.1.0/tests/test_e2e.py +342 -0
  52. edgequake_sdk-0.1.0/tests/test_errors.py +219 -0
  53. edgequake_sdk-0.1.0/tests/test_lineage.py +442 -0
  54. edgequake_sdk-0.1.0/tests/test_package.py +44 -0
  55. edgequake_sdk-0.1.0/tests/test_pagination.py +185 -0
  56. edgequake_sdk-0.1.0/tests/test_resources_auth.py +558 -0
  57. edgequake_sdk-0.1.0/tests/test_resources_conversations.py +529 -0
  58. edgequake_sdk-0.1.0/tests/test_resources_documents.py +979 -0
  59. edgequake_sdk-0.1.0/tests/test_resources_graph.py +715 -0
  60. edgequake_sdk-0.1.0/tests/test_resources_operations.py +1312 -0
  61. edgequake_sdk-0.1.0/tests/test_resources_query_chat.py +634 -0
  62. edgequake_sdk-0.1.0/tests/test_streaming.py +319 -0
  63. edgequake_sdk-0.1.0/tests/test_transport.py +776 -0
  64. edgequake_sdk-0.1.0/tests/test_types.py +199 -0
@@ -0,0 +1,68 @@
1
+ name: Test Python SDK
2
+ on:
3
+ push:
4
+ branches: [main, "feat/*"]
5
+ paths: ["sdks/python/**"]
6
+ pull_request:
7
+ branches: [main]
8
+ paths: ["sdks/python/**"]
9
+
10
+ defaults:
11
+ run:
12
+ working-directory: sdks/python
13
+
14
+ jobs:
15
+ lint:
16
+ name: Lint
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+ - run: pip install ruff mypy
24
+ - run: ruff check edgequake/
25
+ - run: ruff format --check edgequake/ tests/
26
+ - run: mypy edgequake/ --ignore-missing-imports
27
+
28
+ test:
29
+ name: Test (Python ${{ matrix.python-version }})
30
+ runs-on: ubuntu-latest
31
+ strategy:
32
+ matrix:
33
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: actions/setup-python@v5
37
+ with:
38
+ python-version: ${{ matrix.python-version }}
39
+ - run: pip install -e ".[dev]"
40
+ - run: python -m pytest tests/ -m "not integration and not e2e" -q --tb=short
41
+ - name: Coverage
42
+ if: matrix.python-version == '3.12'
43
+ run: |
44
+ python -m pytest tests/ -m "not integration and not e2e" \
45
+ --cov=edgequake --cov-report=term --cov-report=xml:coverage.xml
46
+ - name: Upload coverage
47
+ if: matrix.python-version == '3.12'
48
+ uses: actions/upload-artifact@v4
49
+ with:
50
+ name: coverage-report
51
+ path: sdks/python/coverage.xml
52
+
53
+ build:
54
+ name: Build
55
+ runs-on: ubuntu-latest
56
+ needs: [lint, test]
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - uses: actions/setup-python@v5
60
+ with:
61
+ python-version: "3.12"
62
+ - run: pip install build
63
+ - run: python -m build
64
+ - name: Verify dist output
65
+ run: |
66
+ ls dist/*.whl || (echo "Missing wheel" && exit 1)
67
+ ls dist/*.tar.gz || (echo "Missing sdist" && exit 1)
68
+ echo "Build output verified ✅"
@@ -0,0 +1,26 @@
1
+ # Python build artifacts
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ .eggs/
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+ env/
15
+
16
+ # Testing
17
+ .coverage
18
+ htmlcov/
19
+ .pytest_cache/
20
+ .mypy_cache/
21
+ .ruff_cache/
22
+
23
+ # IDE
24
+ .idea/
25
+ .vscode/
26
+ *.swp
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to the EdgeQuake Python SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-02-12
9
+
10
+ ### Added
11
+
12
+ - Complete API coverage (20+ resource namespaces)
13
+ - Streaming query support via Server-Sent Events (SSE)
14
+ - Multi-tenant authentication with workspace IDs
15
+ - Comprehensive examples (8 runnable scenarios)
16
+ - Full API documentation in `docs/` folder
17
+ - Authentication guide (`docs/AUTHENTICATION.md`)
18
+ - Streaming guide (`docs/STREAMING.md`)
19
+ - Enhanced README with resource namespaces table and troubleshooting
20
+
21
+ ### Fixed
22
+
23
+ - Cursor-based pagination implementation (Phase 6 fix)
24
+ - Async client resource cleanup
25
+ - Error handling for edge cases in streaming
26
+ - Type hints for all public methods
27
+
28
+ ### Changed
29
+
30
+ - Improved error messages for better debugging
31
+ - Updated documentation to match TypeScript SDK quality standard
32
+
33
+ ## [0.1.0] - 2026-02-10
34
+
35
+ ### Added
36
+
37
+ - Initial Python SDK release
38
+ - Basic CRUD operations for documents, queries, graphs
39
+ - Synchronous client (`EdgequakeClient`)
40
+ - Asynchronous client (`AsyncEdgequakeClient`)
41
+ - Authentication support (API key, JWT tokens)
42
+ - Basic test coverage
43
+
44
+ ---
45
+
46
+ [1.0.0]: https://github.com/edgequake/edgequake/compare/python-sdk-v0.1.0...python-sdk-v1.0.0
47
+ [0.1.0]: https://github.com/edgequake/edgequake/releases/tag/python-sdk-v0.1.0
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to the Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by the Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding any notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ Copyright 2025 EdgeQuake Contributors
178
+
179
+ Licensed under the Apache License, Version 2.0 (the "License");
180
+ you may not use this file except in compliance with the License.
181
+ You may obtain a copy of the License at
182
+
183
+ http://www.apache.org/licenses/LICENSE-2.0
184
+
185
+ Unless required by applicable law or agreed to in writing, software
186
+ distributed under the License is distributed on an "AS IS" BASIS,
187
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
+ See the License for the specific language governing permissions and
189
+ limitations under the License.
@@ -0,0 +1,319 @@
1
+ Metadata-Version: 2.4
2
+ Name: edgequake-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the EdgeQuake RAG API
5
+ Project-URL: Homepage, https://github.com/edgequake/edgequake
6
+ Project-URL: Documentation, https://github.com/edgequake/edgequake/tree/main/sdks/python
7
+ Project-URL: Repository, https://github.com/edgequake/edgequake
8
+ Project-URL: Issues, https://github.com/edgequake/edgequake/issues
9
+ Author: EdgeQuake Contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: api-client,edgequake,knowledge-graph,rag,sdk
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: httpx<1.0.0,>=0.27.0
25
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: coverage>=7.0; extra == 'dev'
28
+ Requires-Dist: mypy>=1.10; extra == 'dev'
29
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
30
+ Requires-Dist: pytest-httpx>=0.34; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0; extra == 'dev'
32
+ Requires-Dist: respx>=0.22; extra == 'dev'
33
+ Requires-Dist: ruff>=0.8; extra == 'dev'
34
+ Provides-Extra: ws
35
+ Requires-Dist: websockets<14.0,>=12.0; extra == 'ws'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # EdgeQuake Python SDK
39
+
40
+ Official Python SDK for the [EdgeQuake](https://github.com/edgequake/edgequake) RAG API.
41
+
42
+ ## Features
43
+
44
+ - **Dual API**: Synchronous (`EdgeQuake`) and asynchronous (`AsyncEdgeQuake`) clients
45
+ - **Type-safe**: Full Pydantic v2 models for all request/response types
46
+ - **Streaming**: SSE streaming for query and chat endpoints
47
+ - **Auto-pagination**: Transparent iteration over paginated results
48
+ - **Auth**: API key, JWT, and multi-tenant authentication
49
+ - **Retry**: Automatic exponential backoff on 429/503 errors
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install edgequake-sdk
55
+ ```
56
+
57
+ For WebSocket support (async pipeline progress):
58
+
59
+ ```bash
60
+ pip install edgequake-sdk[ws]
61
+ ```
62
+
63
+ ## Quick Start
64
+
65
+ ### Sync Client
66
+
67
+ ```python
68
+ from edgequake import EdgeQuake
69
+
70
+ client = EdgeQuake(
71
+ base_url="http://localhost:8080",
72
+ api_key="your-api-key",
73
+ )
74
+
75
+ # Check health
76
+ health = client.health()
77
+ print(f"Status: {health.status}")
78
+
79
+ # Upload a document
80
+ doc = client.documents.upload(
81
+ content="EdgeQuake is an advanced RAG framework...",
82
+ title="About EdgeQuake",
83
+ )
84
+ print(f"Document ID: {doc.document_id}")
85
+
86
+ # Query the knowledge graph
87
+ result = client.query.execute(query="What is EdgeQuake?")
88
+ print(result.answer)
89
+
90
+ # Stream a query
91
+ for event in client.query.stream(query="Explain RAG"):
92
+ if event.chunk:
93
+ print(event.chunk, end="", flush=True)
94
+ ```
95
+
96
+ ### Async Client
97
+
98
+ ```python
99
+ import asyncio
100
+ from edgequake import AsyncEdgeQuake
101
+
102
+ async def main():
103
+ async with AsyncEdgeQuake(
104
+ base_url="http://localhost:8080",
105
+ api_key="your-api-key",
106
+ ) as client:
107
+ health = await client.health()
108
+ print(f"Status: {health.status}")
109
+
110
+ result = await client.query.execute(query="What is EdgeQuake?")
111
+ print(result.answer)
112
+
113
+ asyncio.run(main())
114
+ ```
115
+
116
+ ## 📍 Resource Namespaces
117
+
118
+ The Python SDK provides access to 20+ resource namespaces:
119
+
120
+ | Namespace | Description | Example |
121
+ | --------------- | ------------------------------------------ | ------------------------------------------------ |
122
+ | `documents` | Document upload, retrieval, and management | `client.documents.upload(content="...")` |
123
+ | `query` | RAG query execution (sync and streaming) | `client.query.execute(query="...")` |
124
+ | `graph` | Knowledge graph exploration and traversal | `client.graph.get()` |
125
+ | `chat` | OpenAI-compatible chat completions | `client.chat.completions(messages=[...])` |
126
+ | `conversations` | Multi-turn conversation management | `client.conversations.create(title="...")` |
127
+ | `auth` | Authentication (login, JWT refresh) | `client.auth.login(email="...", password="...")` |
128
+ | `operations` | Long-running operation tracking | `client.operations.list()` |
129
+ | `tenants` | Multi-tenant management (admin only) | `client.tenants.create(name="...")` |
130
+ | `workspaces` | Workspace management | `client.workspaces.stats(workspace_id="...")` |
131
+
132
+ **API Coverage:** 100+ endpoints across 9 core resources
133
+
134
+ For complete API reference, see [`docs/API.md`](docs/API.md).
135
+
136
+ ## ⚙️ Configuration
137
+
138
+ Configure the client with these options:
139
+
140
+ ```python
141
+ from edgequake import EdgeQuake
142
+
143
+ client = EdgeQuake(
144
+ api_key="YOUR_API_KEY", # Required: API authentication key
145
+ base_url="http://localhost:8080", # Server URL (default: http://localhost:8080)
146
+ timeout=30, # Request timeout in seconds (default: 30)
147
+ max_retries=3, # Retry attempts on failure (default: 3)
148
+ workspace_id="my-workspace", # Optional: Default workspace context
149
+ tenant_id="my-tenant", # Optional: Multi-tenant context
150
+ )
151
+ ```
152
+
153
+ **Configuration Parameters:**
154
+
155
+ | Parameter | Type | Default | Description |
156
+ | -------------- | ----- | ----------------------- | ------------------------------------- |
157
+ | `api_key` | `str` | - | API key for authentication (required) |
158
+ | `base_url` | `str` | `http://localhost:8080` | EdgeQuake server URL |
159
+ | `timeout` | `int` | `30` | Request timeout in seconds |
160
+ | `max_retries` | `int` | `3` | Number of retry attempts on failure |
161
+ | `workspace_id` | `str` | `None` | Default workspace for multi-tenancy |
162
+ | `tenant_id` | `str` | `None` | Tenant ID for multi-tenant setup |
163
+
164
+ ## 🌍 Environment Variables
165
+
166
+ The SDK reads these environment variables automatically:
167
+
168
+ | Variable | Purpose | Example |
169
+ | ------------------------ | -------------------------------------------- | ----------------------------------- |
170
+ | `EDGEQUAKE_API_KEY` | API authentication key (overrides parameter) | `sk-your-api-key-here` |
171
+ | `EDGEQUAKE_BASE_URL` | Server URL | `http://localhost:8080` |
172
+ | `EDGEQUAKE_URL` | Alternative to `EDGEQUAKE_BASE_URL` | `https://api.edgequake.example.com` |
173
+ | `EDGEQUAKE_WORKSPACE_ID` | Default workspace ID | `my-workspace` |
174
+ | `EDGEQUAKE_TENANT_ID` | Tenant ID for multi-tenancy | `tenant-123` |
175
+ | `EDGEQUAKE_TIMEOUT` | Request timeout in seconds | `60` |
176
+
177
+ **Example:**
178
+
179
+ ```bash
180
+ export EDGEQUAKE_API_KEY="your-api-key"
181
+ export EDGEQUAKE_BASE_URL="http://localhost:8080"
182
+ python your_script.py
183
+ ```
184
+
185
+ Then in your code:
186
+
187
+ ```python
188
+ from edgequake import EdgeQuake
189
+
190
+ # Reads from environment variables automatically
191
+ client = EdgeQuake()
192
+ ```
193
+
194
+ ## 💡 Examples
195
+
196
+ See the [`examples/`](examples/) directory for complete, runnable examples:
197
+
198
+ | Example | Description |
199
+ | ------------------------------------------------------- | ------------------------------------------------------ |
200
+ | [`basic_usage.py`](examples/basic_usage.py) | Hello world — client setup, health check, simple query |
201
+ | [`document_upload.py`](examples/document_upload.py) | Document management (upload, track, list, delete) |
202
+ | [`graph_exploration.py`](examples/graph_exploration.py) | Navigate the knowledge graph |
203
+ | [`query_demo.py`](examples/query_demo.py) | Different query modes (simple, hybrid, chat) |
204
+ | [`streaming_query.py`](examples/streaming_query.py) | Real-time streaming responses (SSE) |
205
+ | [`error_handling.py`](examples/error_handling.py) | Graceful error handling patterns |
206
+ | [`configuration.py`](examples/configuration.py) | Advanced configuration and multi-environment setup |
207
+ | [`multi_tenant.py`](examples/multi_tenant.py) | Tenant and workspace management |
208
+
209
+ **Run any example:**
210
+
211
+ ```bash
212
+ export EDGEQUAKE_API_KEY="your-key"
213
+ python examples/basic_usage.py
214
+ ```
215
+
216
+ For detailed example descriptions, see [`examples/README.md`](examples/README.md).
217
+
218
+ ## Authentication
219
+
220
+ ```python
221
+ # API Key (recommended for server-side)
222
+ client = EdgeQuake(base_url="...", api_key="your-key")
223
+
224
+ # JWT Bearer token
225
+ client = EdgeQuake(base_url="...", jwt="eyJhbGciOi...")
226
+
227
+ # Multi-tenant
228
+ client = EdgeQuake(
229
+ base_url="...",
230
+ api_key="your-key",
231
+ tenant_id="tenant-abc",
232
+ workspace_id="workspace-xyz",
233
+ )
234
+ ```
235
+
236
+ ## Requirements
237
+
238
+ - Python >= 3.10
239
+ - httpx >= 0.27
240
+ - pydantic >= 2.0
241
+
242
+ ## 🔧 Troubleshooting
243
+
244
+ ### Connection Errors
245
+
246
+ **Problem:** `ConnectionError: [Errno 61] Connection refused`
247
+ **Solution:** Ensure EdgeQuake server is running on `base_url`
248
+
249
+ ```bash
250
+ # Check if server is reachable
251
+ curl http://localhost:8080/health
252
+ ```
253
+
254
+ ### Authentication Errors
255
+
256
+ **Problem:** `401 Unauthorized`
257
+ **Solution:** Verify that `EDGEQUAKE_API_KEY` is set correctly
258
+
259
+ ```bash
260
+ echo $EDGEQUAKE_API_KEY # Should print your API key
261
+ ```
262
+
263
+ ### Timeout Errors
264
+
265
+ **Problem:** `ReadTimeout: HTTPSConnectionPool`
266
+ **Solution:** Increase timeout for long-running operations:
267
+
268
+ ```python
269
+ client = EdgeQuake(
270
+ api_key="your-key",
271
+ timeout=60 # Increase to 60 seconds
272
+ )
273
+ ```
274
+
275
+ ### Streaming Issues
276
+
277
+ **Problem:** SSE connection drops or no output
278
+ **Solution:**
279
+
280
+ 1. Ensure output is flushed: `print(chunk, end="", flush=True)`
281
+ 2. Check network stability
282
+ 3. See [`docs/STREAMING.md`](docs/STREAMING.md) for reconnection strategies
283
+
284
+ ### Import Errors
285
+
286
+ **Problem:** `ModuleNotFoundError: No module named 'edgequake'`
287
+ **Solution:** Install the SDK:
288
+
289
+ ```bash
290
+ pip install edgequake-sdk
291
+ ```
292
+
293
+ ### Empty Query Results
294
+
295
+ **Problem:** Queries return empty or "I don't know" responses
296
+ **Solution:** Upload and process documents first:
297
+
298
+ ```python
299
+ doc = client.documents.upload(content="...", title="...")
300
+ # Wait for processing to complete (check track_id status)
301
+ ```
302
+
303
+ For more troubleshooting, see:
304
+
305
+ - **API Reference:** [`docs/API.md`](docs/API.md)
306
+ - **Authentication Guide:** [`docs/AUTHENTICATION.md`](docs/AUTHENTICATION.md)
307
+ - **Streaming Guide:** [`docs/STREAMING.md`](docs/STREAMING.md)
308
+
309
+ ## 📚 Documentation
310
+
311
+ - **API Reference:** [`docs/API.md`](docs/API.md) — Complete API documentation
312
+ - **Authentication:** [`docs/AUTHENTICATION.md`](docs/AUTHENTICATION.md) — API key, JWT, multi-tenant auth
313
+ - **Streaming:** [`docs/STREAMING.md`](docs/STREAMING.md) — SSE streaming guide
314
+ - **Examples:** [`examples/README.md`](examples/README.md) — Runnable code examples
315
+ - **Changelog:** [`CHANGELOG.md`](CHANGELOG.md) — Version history
316
+
317
+ ## License
318
+
319
+ Apache License 2.0