slide-narrator 0.2.2__py3-none-any.whl → 0.4.0__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.

Potentially problematic release.


This version of slide-narrator might be problematic. Click here for more details.

narrator/__init__.py CHANGED
@@ -8,7 +8,7 @@ from .models.thread import Thread
8
8
  from .models.message import Message
9
9
  from .models.attachment import Attachment
10
10
 
11
- __version__ = "0.2.2"
11
+ __version__ = "0.4.0"
12
12
  __all__ = [
13
13
  "ThreadStore",
14
14
  "FileStore",
@@ -1,6 +1,6 @@
1
1
  """Storage backend implementations for ThreadStore."""
2
2
  from abc import ABC, abstractmethod
3
- from typing import List, Optional, Dict, Any
3
+ from typing import List, Optional, Dict, Any, Union
4
4
  from datetime import datetime, UTC
5
5
  import json
6
6
  import os
@@ -64,7 +64,7 @@ class StorageBackend(ABC):
64
64
  pass
65
65
 
66
66
  @abstractmethod
67
- async def find_messages_by_attribute(self, path: str, value: Any) -> List[MessageRecord]:
67
+ async def find_messages_by_attribute(self, path: str, value: Any) -> Union[List[Message], List[MessageRecord]]:
68
68
  """
69
69
  Find messages that have a specific attribute at a given JSON path.
70
70
  Uses efficient SQL JSON path queries for PostgreSQL and falls back to
@@ -138,7 +138,7 @@ class MemoryBackend(StorageBackend):
138
138
  threads = threads[:limit]
139
139
  return threads
140
140
 
141
- async def find_messages_by_attribute(self, path: str, value: Any) -> List[MessageRecord]:
141
+ async def find_messages_by_attribute(self, path: str, value: Any) -> List[Message]:
142
142
  """
143
143
  Check if any messages exist with a specific attribute at a given JSON path.
144
144
 
@@ -147,7 +147,7 @@ class MemoryBackend(StorageBackend):
147
147
  value: The value to search for
148
148
 
149
149
  Returns:
150
- True if any messages match, False otherwise
150
+ List of messages matching the criteria (possibly empty)
151
151
  """
152
152
  # Traverse all threads and messages
153
153
  for thread in self._threads.values():
@@ -166,7 +166,9 @@ class MemoryBackend(StorageBackend):
166
166
 
167
167
  # Check if we found a match
168
168
  if current == value:
169
- return [self._create_message_record(message, thread.id, 0)]
169
+ # For MemoryBackend, we can't return MessageRecord objects
170
+ # Return a list containing the message data that the ThreadStore can handle
171
+ return [message]
170
172
 
171
173
  return []
172
174
 
@@ -190,13 +190,15 @@ class ThreadStore:
190
190
  """
191
191
  await self._ensure_initialized()
192
192
  if hasattr(self._backend, 'find_messages_by_attribute'):
193
- message_records = await self._backend.find_messages_by_attribute(path, value)
193
+ results = await self._backend.find_messages_by_attribute(path, value)
194
194
 
195
- # Convert MessageRecord objects to Message objects
195
+ # Handle different return types from different backends
196
196
  messages = []
197
- if hasattr(self._backend, '_create_message_from_record'):
198
- for record in message_records:
199
- message = self._backend._create_message_from_record(record)
197
+ for item in results:
198
+ if hasattr(item, 'model_dump'): # It's a Message object (from MemoryBackend)
199
+ messages.append(item)
200
+ elif hasattr(self._backend, '_create_message_from_record'): # It's a MessageRecord (from SQLBackend)
201
+ message = self._backend._create_message_from_record(item)
200
202
  messages.append(message)
201
203
 
202
204
  return messages
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slide-narrator
3
- Version: 0.2.2
3
+ Version: 0.4.0
4
4
  Summary: Thread and file storage components for conversational AI - the companion to Tyler AI framework
5
5
  Project-URL: Homepage, https://github.com/adamwdraper/slide
6
6
  Project-URL: Repository, https://github.com/adamwdraper/slide
@@ -35,14 +35,14 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  # The Narrator
37
37
 
38
- Thread and file storage components for conversational AI - the companion to Tyler AI framework.
38
+ Thread and file storage components for conversational AI - the storage foundation for the Slide ecosystem.
39
39
 
40
40
  ## Overview
41
41
 
42
- The Narrator provides robust, production-ready storage solutions for conversational AI applications. It includes:
42
+ The Narrator provides robust, production-ready storage solutions for conversational AI applications, serving as the storage layer for Tyler and other Slide components. It includes:
43
43
 
44
44
  - **ThreadStore**: Persistent storage for conversation threads with support for both in-memory and SQL backends
45
- - **FileStore**: Secure file storage with automatic processing for various file types
45
+ - **FileStore**: Secure file storage with automatic processing for various file types
46
46
  - **Models**: Pydantic models for threads, messages, and attachments
47
47
  - **CLI Tools**: Command-line interface for database management and setup
48
48
 
@@ -52,10 +52,10 @@ The Narrator provides robust, production-ready storage solutions for conversatio
52
52
  - **Multiple Backends**: In-memory (development), SQLite (local), PostgreSQL (production)
53
53
  - **Async/Await Support**: Built for modern Python async applications
54
54
  - **Message Filtering**: Automatic handling of system vs. user messages
55
- - **Platform Integration**: Support for external platform references (Slack, etc.)
55
+ - **Platform Integration**: Support for external platform references (Slack, Discord, etc.)
56
56
  - **Connection Pooling**: Production-ready database connection management
57
57
 
58
- ### FileStore
58
+ ### FileStore
59
59
  - **Secure Storage**: Automatic file validation and type checking
60
60
  - **Multiple Formats**: Support for documents, images, audio, and more
61
61
  - **Content Processing**: Automatic text extraction from PDFs, image analysis
@@ -65,7 +65,11 @@ The Narrator provides robust, production-ready storage solutions for conversatio
65
65
  ## Installation
66
66
 
67
67
  ```bash
68
- pip install the-narrator
68
+ # Using uv (recommended)
69
+ uv add slide-narrator
70
+
71
+ # Using pip (fallback)
72
+ pip install slide-narrator
69
73
  ```
70
74
 
71
75
  ## Setup
@@ -395,43 +399,13 @@ Available commands:
395
399
  - `narrator-db init` - Initialize database tables
396
400
  - `narrator-db status` - Check database connection and basic statistics
397
401
 
398
- ## Migration from Tyler
399
-
400
- If you're migrating from the original Tyler package:
401
-
402
- 1. **Update imports**:
403
- ```python
404
- # Before
405
- from tyler import ThreadStore, FileStore, Thread, Message
406
-
407
- # After
408
- from narrator import ThreadStore, FileStore, Thread, Message
409
- ```
410
-
411
- 2. **Update environment variables**:
412
- ```bash
413
- # Before
414
- TYLER_DB_POOL_SIZE=5
415
- TYLER_FILE_STORAGE_PATH=/path/to/files
416
-
417
- # After
418
- NARRATOR_DB_POOL_SIZE=5
419
- NARRATOR_FILE_STORAGE_PATH=/path/to/files
420
- ```
421
-
422
- 3. **Remove registry usage**:
423
- ```python
424
- # Before (with registry)
425
- from tyler.utils.registry import register_thread_store, get_thread_store
426
- register_thread_store("default", store)
427
- store = get_thread_store("default")
428
-
429
- # After (direct usage)
430
- store = await ThreadStore.create("your-database-url")
431
- # Use store directly
432
- ```
402
+ ## Key Design Principles
433
403
 
434
- 4. **Database compatibility**: The database schema is fully compatible, so existing data will work without changes.
404
+ 1. **Factory Pattern**: Use `await ThreadStore.create()` and `await FileStore.create()` for proper initialization and connection validation
405
+ 2. **Backend Agnostic**: Same API whether using in-memory, SQLite, or PostgreSQL storage
406
+ 3. **Production Ready**: Built-in connection pooling, error handling, and health checks
407
+ 4. **Tyler Integration**: Seamlessly integrates with Tyler agents for conversation persistence
408
+ 5. **Platform Support**: Native support for external platforms like Slack, Discord, and custom integrations
435
409
 
436
410
  ## API Reference
437
411
 
@@ -1,9 +1,9 @@
1
- narrator/__init__.py,sha256=SOZ8kAAB9YOkje9RM_1woh7wQYfQQPH6sKRQhswOjss,403
1
+ narrator/__init__.py,sha256=UAMzbmFCuOt2MMM9qz01m_6KzESSo3RFVCKWa1oUMx0,403
2
2
  narrator/database/__init__.py,sha256=UngOnFqImCeJiMZlMasm72mC4-UnJDDvfu1MNQLkRA8,189
3
3
  narrator/database/cli.py,sha256=Wi5kSXWFTkWBjZS1N9AuGEmTUrYjafUOTZUSO9cGfTM,1954
4
4
  narrator/database/models.py,sha256=wsG_5GrPo41hAcojjZTZmSx6bijea-Skan-DwzHs8os,2607
5
- narrator/database/storage_backend.py,sha256=JajlWQKbMn2OUQLHFfHkKV_sgnUISFMMuYv6Rc3N-Hk,25277
6
- narrator/database/thread_store.py,sha256=UrFZkBoIEFPBIMqcFkc8mdE6q1lu2VxSpZQ6S2LsZ6k,11136
5
+ narrator/database/storage_backend.py,sha256=UeMgxW8h3ZNWORZNH_f-jZuHNjHpREBaOOAFPeEPlvA,25444
6
+ narrator/database/thread_store.py,sha256=vMIPDdwuSpTyPogEUmxGcILxM_r1wxoQBUOn8XJpdqM,11301
7
7
  narrator/database/migrations/__init__.py,sha256=IqoSL8eCcbcOtn96u2_TTrNG0KN1Jn1yreDZEO4RsnM,173
8
8
  narrator/models/__init__.py,sha256=J8Rsv2lmfGR5QmUjoAPEFTSQt5TGtyrBynnp17HdZnU,179
9
9
  narrator/models/attachment.py,sha256=6fZnGla_Ahgc4Kro2bHBTWoF_Kr-mUBHzONizVH73oc,16129
@@ -13,8 +13,8 @@ narrator/storage/__init__.py,sha256=K4cxGITSQoQiw32QOWZsCBm11fwDTbsyzHGeAqcL6yY,
13
13
  narrator/storage/file_store.py,sha256=-k1ZYzKYioCMiP7KfWuuCmCeAzDqRv38ndpuM75yISY,20047
14
14
  narrator/utils/__init__.py,sha256=P4BhLvBJbBvb8qha2tTZPlYbjCRXth_K97f4vNc77UI,109
15
15
  narrator/utils/logging.py,sha256=K9EWI7lP4CNQpPwggiqzMex7oF6oyL3wIVLik2iuXd4,1983
16
- slide_narrator-0.2.2.dist-info/METADATA,sha256=EyaU7J59QZhyxqXyzDJlxHIHn5iVmeQKZFoWKdvB0Cc,15435
17
- slide_narrator-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
- slide_narrator-0.2.2.dist-info/entry_points.txt,sha256=EaFuawrdPNFByqzAb17gkkDyj4FgelJqmII6ioD-i_I,59
19
- slide_narrator-0.2.2.dist-info/licenses/LICENSE,sha256=g6cGasroU9sqSOjThWg14w0BMlwZhgmOQQVTiu036ks,1068
20
- slide_narrator-0.2.2.dist-info/RECORD,,
16
+ slide_narrator-0.4.0.dist-info/METADATA,sha256=d32N9g2Bp399aphM7GxuE4eDwglX20d4MWJD-JI1Dy0,15194
17
+ slide_narrator-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ slide_narrator-0.4.0.dist-info/entry_points.txt,sha256=EaFuawrdPNFByqzAb17gkkDyj4FgelJqmII6ioD-i_I,59
19
+ slide_narrator-0.4.0.dist-info/licenses/LICENSE,sha256=g6cGasroU9sqSOjThWg14w0BMlwZhgmOQQVTiu036ks,1068
20
+ slide_narrator-0.4.0.dist-info/RECORD,,