cerid-sdk 0.1.1__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.
- cerid_sdk-0.1.1/.gitignore +150 -0
- cerid_sdk-0.1.1/LICENSE +190 -0
- cerid_sdk-0.1.1/PKG-INFO +121 -0
- cerid_sdk-0.1.1/README.md +93 -0
- cerid_sdk-0.1.1/examples/telegram-capture/README.md +67 -0
- cerid_sdk-0.1.1/examples/telegram-capture/bot.py +136 -0
- cerid_sdk-0.1.1/examples/telegram-capture/requirements.txt +9 -0
- cerid_sdk-0.1.1/pyproject.toml +39 -0
- cerid_sdk-0.1.1/src/cerid/__init__.py +16 -0
- cerid_sdk-0.1.1/src/cerid/__version__.py +12 -0
- cerid_sdk-0.1.1/src/cerid/_async_client.py +104 -0
- cerid_sdk-0.1.1/src/cerid/_base.py +44 -0
- cerid_sdk-0.1.1/src/cerid/client.py +104 -0
- cerid_sdk-0.1.1/src/cerid/errors.py +82 -0
- cerid_sdk-0.1.1/src/cerid/models.py +198 -0
- cerid_sdk-0.1.1/src/cerid/py.typed +0 -0
- cerid_sdk-0.1.1/src/cerid/resources/__init__.py +20 -0
- cerid_sdk-0.1.1/src/cerid/resources/kb.py +248 -0
- cerid_sdk-0.1.1/src/cerid/resources/llm.py +123 -0
- cerid_sdk-0.1.1/src/cerid/resources/memory.py +91 -0
- cerid_sdk-0.1.1/src/cerid/resources/system.py +85 -0
- cerid_sdk-0.1.1/src/cerid/resources/verify.py +77 -0
- cerid_sdk-0.1.1/tests/__init__.py +0 -0
- cerid_sdk-0.1.1/tests/test_client.py +301 -0
- cerid_sdk-0.1.1/tests/test_contract_spec.py +413 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Secrets & keys
|
|
2
|
+
.env
|
|
3
|
+
.env.age
|
|
4
|
+
.env.local
|
|
5
|
+
.env*.local
|
|
6
|
+
.env.meta.json
|
|
7
|
+
.env.*.bak
|
|
8
|
+
.env.*.backup
|
|
9
|
+
.env.pre-live-*
|
|
10
|
+
.env.post-live-*
|
|
11
|
+
.env.public-sandbox
|
|
12
|
+
.env.sandbox
|
|
13
|
+
.env.*-sandbox
|
|
14
|
+
!.env.example
|
|
15
|
+
*.key
|
|
16
|
+
OPENROUTER_API_KEY*
|
|
17
|
+
OPENAI_API_KEY*
|
|
18
|
+
|
|
19
|
+
# Environment dumps & inventory
|
|
20
|
+
src/mcp/docs/inventory/
|
|
21
|
+
|
|
22
|
+
# SQLite databases
|
|
23
|
+
*.db
|
|
24
|
+
*.db-shm
|
|
25
|
+
*.db-wal
|
|
26
|
+
*.db.backup
|
|
27
|
+
*.db.latest
|
|
28
|
+
*.db.new
|
|
29
|
+
stacks/bifrost/config.db.*
|
|
30
|
+
|
|
31
|
+
# Runtime data & volumes. data/* (not data/) so the eval-corpus
|
|
32
|
+
# exception below can re-include a subtree — git cannot re-include
|
|
33
|
+
# children of an excluded DIRECTORY, only of an excluded glob.
|
|
34
|
+
data/*
|
|
35
|
+
# Exception: the frozen synthetic eval corpus is CI input
|
|
36
|
+
# (eval-exploratory seeds it on GH runners — gitignored data/
|
|
37
|
+
# meant the workflow could never pass remotely; 2026-07-10).
|
|
38
|
+
!data/eval-corpus/
|
|
39
|
+
src/mcp/data/
|
|
40
|
+
.cerid-state/
|
|
41
|
+
src/mcp/.cerid-state/
|
|
42
|
+
|
|
43
|
+
# contextplus MCP local index (Ollama-backed; regenerated by `npx -y contextplus init claude`)
|
|
44
|
+
.contextplus/
|
|
45
|
+
contextplus.db
|
|
46
|
+
contextplus.db-*
|
|
47
|
+
.mcp_data/
|
|
48
|
+
# Bifrost provider config is safe to commit (uses env.OPENROUTER_API_KEY, no secrets)
|
|
49
|
+
!stacks/bifrost/data/
|
|
50
|
+
stacks/bifrost/data/*
|
|
51
|
+
!stacks/bifrost/data/config.json
|
|
52
|
+
uploads/
|
|
53
|
+
logs/
|
|
54
|
+
/neo4j/
|
|
55
|
+
/chroma/
|
|
56
|
+
/redis/
|
|
57
|
+
stacks/infrastructure/data/
|
|
58
|
+
artifacts/
|
|
59
|
+
artifacts
|
|
60
|
+
# Nested runtime data dirs (the old bare `data` rule matched any depth;
|
|
61
|
+
# scoped to the known ones so the root data/eval-corpus carve-out works).
|
|
62
|
+
src/mcp/app/data/
|
|
63
|
+
src/mcp/tests/eval/longmemeval/data/
|
|
64
|
+
|
|
65
|
+
# Node
|
|
66
|
+
node_modules/
|
|
67
|
+
|
|
68
|
+
# Next.js / Vercel build artifacts
|
|
69
|
+
.next/
|
|
70
|
+
.vercel/
|
|
71
|
+
|
|
72
|
+
# Python / build
|
|
73
|
+
__pycache__/
|
|
74
|
+
*.pyc
|
|
75
|
+
*.pyo
|
|
76
|
+
*.pyd
|
|
77
|
+
.coverage
|
|
78
|
+
.coverage.*
|
|
79
|
+
htmlcov/
|
|
80
|
+
.pytest_cache/
|
|
81
|
+
.mypy_cache/
|
|
82
|
+
.ruff_cache/
|
|
83
|
+
env/
|
|
84
|
+
venv/
|
|
85
|
+
.venv/
|
|
86
|
+
src/mcp/VERSION
|
|
87
|
+
|
|
88
|
+
# macOS / temp
|
|
89
|
+
.DS_Store
|
|
90
|
+
*.swp
|
|
91
|
+
*~
|
|
92
|
+
Thumbs.db
|
|
93
|
+
|
|
94
|
+
# Runtime logs
|
|
95
|
+
**/*.log
|
|
96
|
+
**/diagnostic.data/
|
|
97
|
+
**/journal/
|
|
98
|
+
|
|
99
|
+
# User documents - never commit
|
|
100
|
+
*.pdf
|
|
101
|
+
*.docx
|
|
102
|
+
*.xlsx
|
|
103
|
+
*.csv
|
|
104
|
+
/archive/
|
|
105
|
+
cerid-archive/
|
|
106
|
+
inbox/
|
|
107
|
+
.worktrees/
|
|
108
|
+
backups/
|
|
109
|
+
|
|
110
|
+
# Electron build output
|
|
111
|
+
packages/desktop/out/
|
|
112
|
+
packages/desktop/release/
|
|
113
|
+
|
|
114
|
+
# TypeScript SDK build output (regenerated by `npm run build`)
|
|
115
|
+
packages/sdk/typescript/dist/
|
|
116
|
+
|
|
117
|
+
# AI assistant artifacts
|
|
118
|
+
.superpowers/
|
|
119
|
+
.internal/
|
|
120
|
+
tests/beta/reports/
|
|
121
|
+
tests/beta/eval/reports/
|
|
122
|
+
|
|
123
|
+
# Internal task tracking & plans (not for public repo)
|
|
124
|
+
tasks/
|
|
125
|
+
.claude/plans/
|
|
126
|
+
# Claude Code session lock files — runtime artifacts, expire on session end
|
|
127
|
+
.claude/*.lock
|
|
128
|
+
# Agent worktrees — live `git worktree` checkouts (184MB as of 2026-07-30).
|
|
129
|
+
# Registered in .git/worktrees, so they are real checkouts, never repo content.
|
|
130
|
+
.claude/worktrees/
|
|
131
|
+
|
|
132
|
+
# Runtime log artifacts
|
|
133
|
+
src/mcp/rag-api-logs.txt
|
|
134
|
+
|
|
135
|
+
# Working documents (not for public repo)
|
|
136
|
+
tests/BUG_REPORT.md
|
|
137
|
+
|
|
138
|
+
# Smoke test scratch directory (host path, outside repo)
|
|
139
|
+
/tmp/cerid-smoke/
|
|
140
|
+
test-results/
|
|
141
|
+
|
|
142
|
+
# Playwright MCP runtime output
|
|
143
|
+
.playwright-mcp/
|
|
144
|
+
docker-compose.override.yml
|
|
145
|
+
|
|
146
|
+
# Eval harness outputs (Phase 0 quality program)
|
|
147
|
+
src/mcp/tests/eval/out/
|
|
148
|
+
scripts/out/
|
|
149
|
+
.mutation-check.lock
|
|
150
|
+
.ci-artifacts/
|
cerid_sdk-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright (c) 2026 Cerid AI. All rights reserved.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
cerid_sdk-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cerid-sdk
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Python SDK for Cerid AI Knowledge Companion
|
|
5
|
+
Author-email: Cerid AI <dev@cerid.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai,cerid,knowledge-base,rag,sdk
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: httpx>=0.25
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Provides-Extra: async
|
|
22
|
+
Requires-Dist: httpx[http2]; extra == 'async'
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: jsonschema; extra == 'test'
|
|
25
|
+
Requires-Dist: pytest; extra == 'test'
|
|
26
|
+
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# cerid-sdk
|
|
30
|
+
|
|
31
|
+
Python client for the [Cerid AI Knowledge Companion](https://github.com/Cerid-AI/cerid-ai) HTTP API.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install cerid-sdk
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Sync and async clients with typed responses. Resource groups for the
|
|
38
|
+
knowledge base, hallucination verification, semantic memory, and
|
|
39
|
+
system endpoints. Built against the stable `/sdk/v1/` surface; protocol
|
|
40
|
+
drift is enforced server-side by the `sdk-openapi-drift` CI gate.
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from cerid import CeridClient
|
|
46
|
+
|
|
47
|
+
client = CeridClient(base_url="http://localhost:8888")
|
|
48
|
+
|
|
49
|
+
# Search the knowledge base
|
|
50
|
+
results = client.kb.query("what did I read about graph databases last week?")
|
|
51
|
+
for chunk in results.chunks:
|
|
52
|
+
print(chunk.text, chunk.score)
|
|
53
|
+
|
|
54
|
+
# Verify a generated answer against the KB
|
|
55
|
+
report = client.verify.check(
|
|
56
|
+
response_text="Cerid uses Neo4j for graph storage.",
|
|
57
|
+
conversation_id="demo",
|
|
58
|
+
)
|
|
59
|
+
print(report.faithfulness, report.unsupported_claims)
|
|
60
|
+
|
|
61
|
+
# Recall semantic memory
|
|
62
|
+
memories = client.memory.recall("preferred deployment topology", top_k=5)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Async client
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import asyncio
|
|
69
|
+
from cerid import AsyncCeridClient
|
|
70
|
+
|
|
71
|
+
async def main():
|
|
72
|
+
async with AsyncCeridClient(base_url="http://localhost:8888") as client:
|
|
73
|
+
results = await client.kb.query("graph databases")
|
|
74
|
+
print(results.total)
|
|
75
|
+
|
|
76
|
+
asyncio.run(main())
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Resource groups
|
|
80
|
+
|
|
81
|
+
| Group | Endpoint | Purpose |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `client.kb` | `/sdk/v1/query`, `/ingest`, `/search`, `/collections`, `/taxonomy` | Search + ingest the personal knowledge base |
|
|
84
|
+
| `client.verify` | `/sdk/v1/hallucination` | Streaming claim extraction + NLI-gated verification |
|
|
85
|
+
| `client.memory` | `/sdk/v1/memory/extract` | Semantic memory recall + extraction |
|
|
86
|
+
| `client.system` | `/sdk/v1/health`, `/health/detailed`, `/settings`, `/plugins` | Operational endpoints |
|
|
87
|
+
|
|
88
|
+
## Authentication
|
|
89
|
+
|
|
90
|
+
Cerid is local-first by default — `CeridClient(base_url=...)` connects
|
|
91
|
+
to a self-hosted instance with no credentials. For deployments behind
|
|
92
|
+
an authenticating proxy, pass headers via the underlying transport:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
client = CeridClient(
|
|
96
|
+
base_url="https://cerid.your-org.internal",
|
|
97
|
+
headers={"Authorization": "Bearer <token>"},
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Compatibility
|
|
102
|
+
|
|
103
|
+
- Python 3.9+ (3.11 / 3.12 actively tested)
|
|
104
|
+
- httpx 0.25+ (transport)
|
|
105
|
+
- pydantic 2.0+ (response models)
|
|
106
|
+
|
|
107
|
+
## Stability contract
|
|
108
|
+
|
|
109
|
+
The `/sdk/v1/` surface and this client's public types
|
|
110
|
+
(`CeridClient`, `AsyncCeridClient`, `CeridSDKError`, response models)
|
|
111
|
+
follow [semantic versioning](https://semver.org/). Any breaking
|
|
112
|
+
change to a `/sdk/v1/` endpoint is enforced caught by the
|
|
113
|
+
`sdk-openapi-drift` CI gate in the server repo.
|
|
114
|
+
|
|
115
|
+
`SDK_PROTOCOL_VERSION` in `cerid.__version__` mirrors the server's
|
|
116
|
+
expected wire-protocol version. Mismatched server / client versions
|
|
117
|
+
will surface as a `CeridSDKError` rather than silent payload skew.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
Apache-2.0. Source at the [Cerid AI repository](https://github.com/Cerid-AI/cerid-ai).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# cerid-sdk
|
|
2
|
+
|
|
3
|
+
Python client for the [Cerid AI Knowledge Companion](https://github.com/Cerid-AI/cerid-ai) HTTP API.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install cerid-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Sync and async clients with typed responses. Resource groups for the
|
|
10
|
+
knowledge base, hallucination verification, semantic memory, and
|
|
11
|
+
system endpoints. Built against the stable `/sdk/v1/` surface; protocol
|
|
12
|
+
drift is enforced server-side by the `sdk-openapi-drift` CI gate.
|
|
13
|
+
|
|
14
|
+
## Quickstart
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from cerid import CeridClient
|
|
18
|
+
|
|
19
|
+
client = CeridClient(base_url="http://localhost:8888")
|
|
20
|
+
|
|
21
|
+
# Search the knowledge base
|
|
22
|
+
results = client.kb.query("what did I read about graph databases last week?")
|
|
23
|
+
for chunk in results.chunks:
|
|
24
|
+
print(chunk.text, chunk.score)
|
|
25
|
+
|
|
26
|
+
# Verify a generated answer against the KB
|
|
27
|
+
report = client.verify.check(
|
|
28
|
+
response_text="Cerid uses Neo4j for graph storage.",
|
|
29
|
+
conversation_id="demo",
|
|
30
|
+
)
|
|
31
|
+
print(report.faithfulness, report.unsupported_claims)
|
|
32
|
+
|
|
33
|
+
# Recall semantic memory
|
|
34
|
+
memories = client.memory.recall("preferred deployment topology", top_k=5)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Async client
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import asyncio
|
|
41
|
+
from cerid import AsyncCeridClient
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
async with AsyncCeridClient(base_url="http://localhost:8888") as client:
|
|
45
|
+
results = await client.kb.query("graph databases")
|
|
46
|
+
print(results.total)
|
|
47
|
+
|
|
48
|
+
asyncio.run(main())
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Resource groups
|
|
52
|
+
|
|
53
|
+
| Group | Endpoint | Purpose |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `client.kb` | `/sdk/v1/query`, `/ingest`, `/search`, `/collections`, `/taxonomy` | Search + ingest the personal knowledge base |
|
|
56
|
+
| `client.verify` | `/sdk/v1/hallucination` | Streaming claim extraction + NLI-gated verification |
|
|
57
|
+
| `client.memory` | `/sdk/v1/memory/extract` | Semantic memory recall + extraction |
|
|
58
|
+
| `client.system` | `/sdk/v1/health`, `/health/detailed`, `/settings`, `/plugins` | Operational endpoints |
|
|
59
|
+
|
|
60
|
+
## Authentication
|
|
61
|
+
|
|
62
|
+
Cerid is local-first by default — `CeridClient(base_url=...)` connects
|
|
63
|
+
to a self-hosted instance with no credentials. For deployments behind
|
|
64
|
+
an authenticating proxy, pass headers via the underlying transport:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
client = CeridClient(
|
|
68
|
+
base_url="https://cerid.your-org.internal",
|
|
69
|
+
headers={"Authorization": "Bearer <token>"},
|
|
70
|
+
)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Compatibility
|
|
74
|
+
|
|
75
|
+
- Python 3.9+ (3.11 / 3.12 actively tested)
|
|
76
|
+
- httpx 0.25+ (transport)
|
|
77
|
+
- pydantic 2.0+ (response models)
|
|
78
|
+
|
|
79
|
+
## Stability contract
|
|
80
|
+
|
|
81
|
+
The `/sdk/v1/` surface and this client's public types
|
|
82
|
+
(`CeridClient`, `AsyncCeridClient`, `CeridSDKError`, response models)
|
|
83
|
+
follow [semantic versioning](https://semver.org/). Any breaking
|
|
84
|
+
change to a `/sdk/v1/` endpoint is enforced caught by the
|
|
85
|
+
`sdk-openapi-drift` CI gate in the server repo.
|
|
86
|
+
|
|
87
|
+
`SDK_PROTOCOL_VERSION` in `cerid.__version__` mirrors the server's
|
|
88
|
+
expected wire-protocol version. Mismatched server / client versions
|
|
89
|
+
will surface as a `CeridSDKError` rather than silent payload skew.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
Apache-2.0. Source at the [Cerid AI repository](https://github.com/Cerid-AI/cerid-ai).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Telegram Capture Bot — External Ingest Example
|
|
2
|
+
|
|
3
|
+
A minimal Telegram bot that forwards every received message to Cerid via
|
|
4
|
+
`POST /sdk/v1/ingest/external`. This is a self-contained example that
|
|
5
|
+
demonstrates the generic external ingest endpoint — it is **not** a Cerid
|
|
6
|
+
feature and is **not** published to PyPI.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- Python 3.11+
|
|
13
|
+
- A running Cerid stack at `http://localhost:8888` (or override via `CERID_URL`)
|
|
14
|
+
- A Telegram bot token from [@BotFather](https://t.me/BotFather)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. Create a dedicated venv (do NOT install into Cerid's .venv)
|
|
22
|
+
cd packages/sdk/python/examples/telegram-capture
|
|
23
|
+
python3 -m venv .venv
|
|
24
|
+
.venv/bin/pip install -r requirements.txt
|
|
25
|
+
|
|
26
|
+
# 2. Export environment variables
|
|
27
|
+
export TELEGRAM_BOT_TOKEN="<your-bot-token>"
|
|
28
|
+
export CERID_URL="http://localhost:8888" # default
|
|
29
|
+
export CERID_CLIENT_ID="telegram-capture-bot" # optional
|
|
30
|
+
|
|
31
|
+
# 3. Run
|
|
32
|
+
.venv/bin/python bot.py
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## How it works
|
|
38
|
+
|
|
39
|
+
Each Telegram message is translated into a Cerid `ExternalIngestRequest`
|
|
40
|
+
using this `field_mappings` config:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"content": "text",
|
|
45
|
+
"source_uri": "source_uri",
|
|
46
|
+
"ts": "ts_iso",
|
|
47
|
+
"id": "message_id"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The bot injects two synthetic fields (`source_uri`, `ts_iso`) into the
|
|
52
|
+
payload before sending so they resolve cleanly through the dotted-path
|
|
53
|
+
mapper. The resulting `NormalizedItem` is ingested into Cerid's `general`
|
|
54
|
+
domain with `source_type="telegram-bot"` stored as provenance metadata.
|
|
55
|
+
|
|
56
|
+
**The endpoint is generic.** No code in `bot.py` or in Cerid special-cases
|
|
57
|
+
the `"telegram-bot"` source type — the `field_mappings` config is the only
|
|
58
|
+
service-specific knowledge needed.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Adapting for other services
|
|
63
|
+
|
|
64
|
+
Replace the `FIELD_MAPPINGS` dict and `_make_payload` function to match
|
|
65
|
+
the JSON shape your service produces, then post to the same endpoint.
|
|
66
|
+
See `docs/INTEGRATION_GUIDE.md` in the Cerid repo for worked examples
|
|
67
|
+
(Readwise, Pocket, Instapaper, Raindrop).
|