echomine 1.0.2__py3-none-any.whl
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.
- echomine/__init__.py +95 -0
- echomine/adapters/__init__.py +18 -0
- echomine/adapters/openai.py +914 -0
- echomine/cli/__init__.py +20 -0
- echomine/cli/app.py +142 -0
- echomine/cli/commands/__init__.py +16 -0
- echomine/cli/commands/export.py +326 -0
- echomine/cli/commands/get.py +570 -0
- echomine/cli/commands/list.py +203 -0
- echomine/cli/commands/search.py +464 -0
- echomine/cli/formatters.py +345 -0
- echomine/constants.py +126 -0
- echomine/exceptions.py +154 -0
- echomine/export/__init__.py +16 -0
- echomine/export/markdown.py +308 -0
- echomine/models/__init__.py +60 -0
- echomine/models/conversation.py +407 -0
- echomine/models/image.py +67 -0
- echomine/models/message.py +162 -0
- echomine/models/protocols.py +341 -0
- echomine/models/search.py +233 -0
- echomine/py.typed +0 -0
- echomine/search/__init__.py +9 -0
- echomine/search/ranking.py +234 -0
- echomine/utils/__init__.py +7 -0
- echomine/utils/logging.py +337 -0
- echomine-1.0.2.dist-info/METADATA +300 -0
- echomine-1.0.2.dist-info/RECORD +32 -0
- echomine-1.0.2.dist-info/WHEEL +5 -0
- echomine-1.0.2.dist-info/entry_points.txt +2 -0
- echomine-1.0.2.dist-info/licenses/LICENSE +661 -0
- echomine-1.0.2.dist-info/top_level.txt +1 -0
echomine/__init__.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Echomine: Library-first tool for parsing AI conversation exports.
|
|
2
|
+
|
|
3
|
+
This package provides tools for parsing, searching, and exporting AI chat conversation
|
|
4
|
+
exports (initially ChatGPT) with memory-efficient streaming, strict type safety, and
|
|
5
|
+
both programmatic (library) and command-line (CLI) interfaces.
|
|
6
|
+
|
|
7
|
+
Core Features:
|
|
8
|
+
- Stream-based parsing for memory efficiency (handles 1GB+ files)
|
|
9
|
+
- Full-text search with BM25 relevance ranking
|
|
10
|
+
- Date range filtering
|
|
11
|
+
- Markdown export with preserved conversation threading
|
|
12
|
+
- Multi-provider adapter pattern (OpenAI ChatGPT initially)
|
|
13
|
+
|
|
14
|
+
Library-First Architecture:
|
|
15
|
+
The CLI is built on top of the library. All capabilities available via command-line
|
|
16
|
+
are also available programmatically.
|
|
17
|
+
|
|
18
|
+
Example Usage (Library):
|
|
19
|
+
```python
|
|
20
|
+
from echomine import OpenAIAdapter
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
# List conversations
|
|
24
|
+
adapter = OpenAIAdapter()
|
|
25
|
+
for conversation in adapter.stream_conversations(Path("export.json")):
|
|
26
|
+
print(f"{conversation.title}: {len(conversation.messages)} messages")
|
|
27
|
+
|
|
28
|
+
# Search conversations
|
|
29
|
+
results = adapter.search(
|
|
30
|
+
Path("export.json"),
|
|
31
|
+
keywords=["algorithm", "design"],
|
|
32
|
+
limit=10
|
|
33
|
+
)
|
|
34
|
+
for result in results:
|
|
35
|
+
print(f"{result.conversation.title} (score: {result.relevance_score})")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Example Usage (CLI):
|
|
39
|
+
```bash
|
|
40
|
+
# List all conversations
|
|
41
|
+
echomine list export.json
|
|
42
|
+
|
|
43
|
+
# Search with keywords
|
|
44
|
+
echomine search export.json --keywords "algorithm,design" --limit 10
|
|
45
|
+
|
|
46
|
+
# Export to markdown
|
|
47
|
+
echomine export export.json --title "Project" --output project.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Type Safety:
|
|
51
|
+
All public APIs are strictly typed with Pydantic models and mypy --strict compliance.
|
|
52
|
+
|
|
53
|
+
License:
|
|
54
|
+
AGPL-3.0 License - See LICENSE file for details
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
__version__ = "1.0.2"
|
|
58
|
+
__author__ = "Echomine Contributors"
|
|
59
|
+
|
|
60
|
+
# Public API imports (T061-T062)
|
|
61
|
+
from echomine.adapters.openai import OpenAIAdapter
|
|
62
|
+
from echomine.exceptions import (
|
|
63
|
+
EchomineError,
|
|
64
|
+
ParseError,
|
|
65
|
+
SchemaVersionError,
|
|
66
|
+
ValidationError,
|
|
67
|
+
)
|
|
68
|
+
from echomine.export.markdown import MarkdownExporter
|
|
69
|
+
from echomine.models.conversation import Conversation
|
|
70
|
+
from echomine.models.message import Message
|
|
71
|
+
from echomine.models.protocols import ConversationProvider
|
|
72
|
+
from echomine.models.search import SearchQuery, SearchResult
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# T063: __all__ defines public API surface for library consumers
|
|
76
|
+
__all__: list[str] = [
|
|
77
|
+
# Version metadata
|
|
78
|
+
"__version__",
|
|
79
|
+
# Data models
|
|
80
|
+
"Conversation",
|
|
81
|
+
"Message",
|
|
82
|
+
"SearchQuery",
|
|
83
|
+
"SearchResult",
|
|
84
|
+
# Adapters
|
|
85
|
+
"OpenAIAdapter",
|
|
86
|
+
# Exporters
|
|
87
|
+
"MarkdownExporter",
|
|
88
|
+
# Protocols
|
|
89
|
+
"ConversationProvider",
|
|
90
|
+
# Exceptions
|
|
91
|
+
"EchomineError",
|
|
92
|
+
"ParseError",
|
|
93
|
+
"ValidationError",
|
|
94
|
+
"SchemaVersionError",
|
|
95
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Adapters for AI conversation export formats.
|
|
2
|
+
|
|
3
|
+
This module provides streaming adapters for different AI provider export formats,
|
|
4
|
+
enabling O(1) memory consumption regardless of export file size.
|
|
5
|
+
|
|
6
|
+
Public API:
|
|
7
|
+
- OpenAIAdapter: Streams conversations from OpenAI ChatGPT export files
|
|
8
|
+
|
|
9
|
+
Constitution Compliance:
|
|
10
|
+
- Principle VIII: Memory-efficient streaming (FR-003)
|
|
11
|
+
- Principle I: Library-first design (importable adapters)
|
|
12
|
+
- FR-122: ijson streaming parser for O(1) memory
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from echomine.adapters.openai import OpenAIAdapter
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__all__ = ["OpenAIAdapter"]
|