geniffy 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.
Potentially problematic release.
This version of geniffy might be problematic. Click here for more details.
- geniffy-0.1.0/.gitignore +7 -0
- geniffy-0.1.0/LICENSE +21 -0
- geniffy-0.1.0/PKG-INFO +130 -0
- geniffy-0.1.0/README.md +109 -0
- geniffy-0.1.0/pyproject.toml +36 -0
- geniffy-0.1.0/src/geniffy/__init__.py +17 -0
- geniffy-0.1.0/src/geniffy/_client.py +490 -0
- geniffy-0.1.0/src/geniffy/_errors.py +73 -0
- geniffy-0.1.0/src/geniffy/_types.py +128 -0
- geniffy-0.1.0/src/geniffy/py.typed +0 -0
- geniffy-0.1.0/tests/test_client.py +359 -0
geniffy-0.1.0/.gitignore
ADDED
geniffy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Geniffy Innovations Private Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
geniffy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: geniffy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Geniffy for Python: add notes, files and links to a memory, then search it and ask it.
|
|
5
|
+
Project-URL: Homepage, https://geniffy.com
|
|
6
|
+
Project-URL: Documentation, https://docs.geniffy.com
|
|
7
|
+
Author-email: Geniffy <ops@geniffy.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,ai,geniffy,llm,memory,rag
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Requires-Dist: httpx<1,>=0.25
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Geniffy for Python
|
|
23
|
+
|
|
24
|
+
Give your app a memory. Write what each of your users tells you, and put what is known about them
|
|
25
|
+
in front of your model, with where every line came from. When nothing is known, it says so instead
|
|
26
|
+
of guessing.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install geniffy
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Make a key in the Geniffy app under **API keys** and set it as `GENIFFY_API_KEY`.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from geniffy import Geniffy
|
|
36
|
+
|
|
37
|
+
client = Geniffy() # reads GENIFFY_API_KEY
|
|
38
|
+
mem = client.space("customer_1042") # one of your users; nothing else can read it
|
|
39
|
+
|
|
40
|
+
source = mem.memories.add("Priya Nair signs the Lumen renewal, and it comes up in March.")
|
|
41
|
+
mem.sources.wait(source.id) # learning usually takes a few seconds
|
|
42
|
+
|
|
43
|
+
prompt = f"{mem.context('Who signs the Lumen renewal?')}\n\nUser: Who signs the Lumen renewal?"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`context()` returns the memories that bear on the question, one per line, each with where it came from:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
- Priya Nair signs the Lumen renewal. [note, 2026-10-05]
|
|
50
|
+
- The Lumen renewal comes up in March 2027. [note, 2026-10-05]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Ask about something that was never stored and it returns one sentence, `There is nothing stored about
|
|
54
|
+
this yet. Say so rather than guessing.`, never an empty string: a model reads silence as permission to
|
|
55
|
+
invent.
|
|
56
|
+
|
|
57
|
+
## Three ways to recall
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
mem.context("Who signs the renewal?") # a block for your own prompt; the one most apps want
|
|
61
|
+
mem.ask("Who signs the renewal?") # our answer in words, or answer=None and a message saying why
|
|
62
|
+
mem.search("renewal", limit=5) # the raw memories, ranked, to do with as you like
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`context()` and `ask()` judge whether anything bears on the question. `search()` ranks and does not
|
|
66
|
+
judge: it returns its best matches for any question at all.
|
|
67
|
+
|
|
68
|
+
## Spaces: one memory per user
|
|
69
|
+
|
|
70
|
+
A space is your own name for one of your users. Bind a client to it and every call stays inside it.
|
|
71
|
+
A space exists from the first time you write to it; there is nothing to create.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
mem = client.space(f"user_{user.id}") # per request
|
|
75
|
+
client.memories.add("...") # no space: your own memory, the one the Geniffy app shows
|
|
76
|
+
client.spaces() # which spaces hold anything, most recently written first
|
|
77
|
+
client.forget_space("user_8841") # everything held for that user, gone, when they ask
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Add
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
mem.memories.add("A note to remember", title="Call with Priya")
|
|
84
|
+
mem.memories.add(url="https://example.com") # a web page, read once
|
|
85
|
+
mem.memories.add(messages=chat_history) # a conversation, as your framework holds it
|
|
86
|
+
mem.memories.add_file("Pricing.pdf") # PDF or Word (.docx): a path, bytes or a file opened "rb"
|
|
87
|
+
mem.memories.add_many([{"text": "..."}, {"url": "https://..."}])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
A file or page that can't be read raises `UnreadableError`; `error.source` is the row it left, with the reason.
|
|
91
|
+
|
|
92
|
+
## Read and correct
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
page = mem.memories.list(kind="people") # all, people, plan, pref or detail; newest first
|
|
96
|
+
for m in mem.memories.iter(): # every memory, a page at a time
|
|
97
|
+
...
|
|
98
|
+
detail = mem.memories.get(42) # .memory.quote is the sentence it came from; .history its older values
|
|
99
|
+
mem.memories.correct(42, "Priya signs it, with Arjun co-signing.")
|
|
100
|
+
mem.memories.delete(42) # forget it for good
|
|
101
|
+
mem.profile("Priya Nair") # what is lastingly true about someone, and what is going on now
|
|
102
|
+
mem.brief("Priya Nair") # what to read before talking to them
|
|
103
|
+
mem.sources.list(); mem.sources.delete(source.id) # a source, and what only it taught
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Async
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from geniffy import AsyncGeniffy
|
|
110
|
+
|
|
111
|
+
async with AsyncGeniffy() as client:
|
|
112
|
+
mem = client.space("customer_1042")
|
|
113
|
+
await mem.memories.add("Priya wants a demo on Tuesday.")
|
|
114
|
+
print(await mem.context("When is Priya's demo?"))
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Errors, retries and request ids
|
|
118
|
+
|
|
119
|
+
Every error carries the API's own sentence: `AuthenticationError` (a wrong or revoked key),
|
|
120
|
+
`NotFoundError`, `BadRequestError`, `UnreadableError`, `RateLimitError`, `InternalServerError`,
|
|
121
|
+
`APIConnectionError`. Reads are retried twice on network errors, 408, 429 and 5xx. Adding is retried
|
|
122
|
+
only when the request never reached Geniffy, or on 429, so a retry never saves a note twice. Set
|
|
123
|
+
`max_retries=` and `timeout=` on the client to change that.
|
|
124
|
+
|
|
125
|
+
Every response carries an `X-Request-ID`, and every error carries it as `error.request_id`. Paste it into
|
|
126
|
+
**Requests** in the Geniffy app to see that exact call: what was asked, what came back, and how long it took.
|
|
127
|
+
|
|
128
|
+
A key reaches its owner's memory and every space beneath it. Keep it on your server.
|
|
129
|
+
|
|
130
|
+
Docs: https://docs.geniffy.com
|
geniffy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Geniffy for Python
|
|
2
|
+
|
|
3
|
+
Give your app a memory. Write what each of your users tells you, and put what is known about them
|
|
4
|
+
in front of your model, with where every line came from. When nothing is known, it says so instead
|
|
5
|
+
of guessing.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install geniffy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Make a key in the Geniffy app under **API keys** and set it as `GENIFFY_API_KEY`.
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from geniffy import Geniffy
|
|
15
|
+
|
|
16
|
+
client = Geniffy() # reads GENIFFY_API_KEY
|
|
17
|
+
mem = client.space("customer_1042") # one of your users; nothing else can read it
|
|
18
|
+
|
|
19
|
+
source = mem.memories.add("Priya Nair signs the Lumen renewal, and it comes up in March.")
|
|
20
|
+
mem.sources.wait(source.id) # learning usually takes a few seconds
|
|
21
|
+
|
|
22
|
+
prompt = f"{mem.context('Who signs the Lumen renewal?')}\n\nUser: Who signs the Lumen renewal?"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`context()` returns the memories that bear on the question, one per line, each with where it came from:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
- Priya Nair signs the Lumen renewal. [note, 2026-10-05]
|
|
29
|
+
- The Lumen renewal comes up in March 2027. [note, 2026-10-05]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Ask about something that was never stored and it returns one sentence, `There is nothing stored about
|
|
33
|
+
this yet. Say so rather than guessing.`, never an empty string: a model reads silence as permission to
|
|
34
|
+
invent.
|
|
35
|
+
|
|
36
|
+
## Three ways to recall
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
mem.context("Who signs the renewal?") # a block for your own prompt; the one most apps want
|
|
40
|
+
mem.ask("Who signs the renewal?") # our answer in words, or answer=None and a message saying why
|
|
41
|
+
mem.search("renewal", limit=5) # the raw memories, ranked, to do with as you like
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`context()` and `ask()` judge whether anything bears on the question. `search()` ranks and does not
|
|
45
|
+
judge: it returns its best matches for any question at all.
|
|
46
|
+
|
|
47
|
+
## Spaces: one memory per user
|
|
48
|
+
|
|
49
|
+
A space is your own name for one of your users. Bind a client to it and every call stays inside it.
|
|
50
|
+
A space exists from the first time you write to it; there is nothing to create.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
mem = client.space(f"user_{user.id}") # per request
|
|
54
|
+
client.memories.add("...") # no space: your own memory, the one the Geniffy app shows
|
|
55
|
+
client.spaces() # which spaces hold anything, most recently written first
|
|
56
|
+
client.forget_space("user_8841") # everything held for that user, gone, when they ask
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Add
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
mem.memories.add("A note to remember", title="Call with Priya")
|
|
63
|
+
mem.memories.add(url="https://example.com") # a web page, read once
|
|
64
|
+
mem.memories.add(messages=chat_history) # a conversation, as your framework holds it
|
|
65
|
+
mem.memories.add_file("Pricing.pdf") # PDF or Word (.docx): a path, bytes or a file opened "rb"
|
|
66
|
+
mem.memories.add_many([{"text": "..."}, {"url": "https://..."}])
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A file or page that can't be read raises `UnreadableError`; `error.source` is the row it left, with the reason.
|
|
70
|
+
|
|
71
|
+
## Read and correct
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
page = mem.memories.list(kind="people") # all, people, plan, pref or detail; newest first
|
|
75
|
+
for m in mem.memories.iter(): # every memory, a page at a time
|
|
76
|
+
...
|
|
77
|
+
detail = mem.memories.get(42) # .memory.quote is the sentence it came from; .history its older values
|
|
78
|
+
mem.memories.correct(42, "Priya signs it, with Arjun co-signing.")
|
|
79
|
+
mem.memories.delete(42) # forget it for good
|
|
80
|
+
mem.profile("Priya Nair") # what is lastingly true about someone, and what is going on now
|
|
81
|
+
mem.brief("Priya Nair") # what to read before talking to them
|
|
82
|
+
mem.sources.list(); mem.sources.delete(source.id) # a source, and what only it taught
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Async
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from geniffy import AsyncGeniffy
|
|
89
|
+
|
|
90
|
+
async with AsyncGeniffy() as client:
|
|
91
|
+
mem = client.space("customer_1042")
|
|
92
|
+
await mem.memories.add("Priya wants a demo on Tuesday.")
|
|
93
|
+
print(await mem.context("When is Priya's demo?"))
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Errors, retries and request ids
|
|
97
|
+
|
|
98
|
+
Every error carries the API's own sentence: `AuthenticationError` (a wrong or revoked key),
|
|
99
|
+
`NotFoundError`, `BadRequestError`, `UnreadableError`, `RateLimitError`, `InternalServerError`,
|
|
100
|
+
`APIConnectionError`. Reads are retried twice on network errors, 408, 429 and 5xx. Adding is retried
|
|
101
|
+
only when the request never reached Geniffy, or on 429, so a retry never saves a note twice. Set
|
|
102
|
+
`max_retries=` and `timeout=` on the client to change that.
|
|
103
|
+
|
|
104
|
+
Every response carries an `X-Request-ID`, and every error carries it as `error.request_id`. Paste it into
|
|
105
|
+
**Requests** in the Geniffy app to see that exact call: what was asked, what came back, and how long it took.
|
|
106
|
+
|
|
107
|
+
A key reaches its owner's memory and every space beneath it. Keep it on your server.
|
|
108
|
+
|
|
109
|
+
Docs: https://docs.geniffy.com
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "geniffy"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Geniffy for Python: add notes, files and links to a memory, then search it and ask it."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Geniffy", email = "ops@geniffy.com" }]
|
|
14
|
+
keywords = ["memory", "ai", "agents", "llm", "rag", "geniffy"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Software Development :: Libraries",
|
|
20
|
+
"Typing :: Typed",
|
|
21
|
+
]
|
|
22
|
+
dependencies = ["httpx>=0.25,<1"]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
test = ["pytest>=7"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://geniffy.com"
|
|
29
|
+
Documentation = "https://docs.geniffy.com"
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/geniffy"]
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Geniffy for Python: add notes, files and links to a memory, then search it and ask it.
|
|
2
|
+
|
|
3
|
+
from geniffy import Geniffy
|
|
4
|
+
|
|
5
|
+
g = Geniffy() # reads GENIFFY_API_KEY
|
|
6
|
+
g.memories.add("Tarun sets every price before anything is sold.")
|
|
7
|
+
print(g.ask("Who sets prices?").answer)
|
|
8
|
+
"""
|
|
9
|
+
from ._client import DEFAULT_BASE_URL, AsyncGeniffy, Geniffy, __version__
|
|
10
|
+
from ._errors import (APIConnectionError, AuthenticationError, BadRequestError, GeniffyError, InternalServerError,
|
|
11
|
+
NotFoundError, RateLimitError, UnreadableError)
|
|
12
|
+
from ._types import Answer, Memory, MemoryDetail, MemoryPage, Source, SourcePage, SourceRef
|
|
13
|
+
|
|
14
|
+
__all__ = ["Geniffy", "AsyncGeniffy", "DEFAULT_BASE_URL", "__version__",
|
|
15
|
+
"Answer", "Memory", "MemoryDetail", "MemoryPage", "Source", "SourcePage", "SourceRef",
|
|
16
|
+
"GeniffyError", "APIConnectionError", "AuthenticationError", "BadRequestError", "UnreadableError",
|
|
17
|
+
"NotFoundError", "RateLimitError", "InternalServerError"]
|