Date: Thursday, May 09, 2024
Work Undertaken Summary
Create initial version of Story Weaver Code: LukeThoma5/StoryWeaver at 20ff6113aabf7d4e7e60430b1110d53b84c66a21 (github.com)
Functionality including:
- CLI argument parsing
- Loading and saving of the ādatabaseā directory
- Loading and batching of input user stories
- Version Control of database directory with git
Risks
Time Spent
1hr StoryWeaver 4hr StoryWeaver
Questions for Tutor
Next work planned
- Create AI component for performing interaction
- Program design diagrams
- Get llama access
- Read up on effective prompting
Raw Notes
Creating StoryWeaver
CLI options
Considered both argparse and click. Click seemed to allow for easier non positional arguments so went with click
Made it easier to re-run the script several times by introducing a .env file and loading env variables before running the entry point.
allowing for common arguments like the input and output directory to not be specified every time.
Loading and saving index file
Could use json or jsonpickle decided to go with json pickle to allow the index to be saved and restored from index very easily, without marshalling of the types involved.
Loading the user stories
Couldnāt use jsonpickle because the json was being created from an external system.
Wanted to avoid the manual creation if I used json.
Found these two libraries:
https://pypi.org/project/dataclasses-json/
https://pypi.org/project/dataclass-wizard/
went with dataclasses-json as it had a much bigger following on github.
UnicodeEncodeError
'charmap' codec can't encode character '\u200b' in position 48228: character maps to <undefined>
Some of the pepper cards include non printing characters like the zero-width space. Used a regex in storytransformer to remove any non printing characters.
Making First or default types work
Was using python3.9, had to bump to 3.12 to be able to make a generic function to keep type safety
def first_or_default[T](list: list[T], predicate: callable) -> T:
return next(filter(predicate, list), None)ImportError: cannot import name āStoryFileā from partially initialized module ācoreā (most likely due to a circular import)
Moved StoryFile into its own file and had the ācoreā and āllmā module read them separately