ommlds 0.0.0.dev366__tar.gz → 0.0.0.dev368__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.
- {ommlds-0.0.0.dev366/ommlds.egg-info → ommlds-0.0.0.dev368}/PKG-INFO +3 -3
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/__init__.py +6 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/anthropic/chat.py +2 -2
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/google/chat.py +4 -4
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/llamacpp/format.py +2 -2
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/mistral.py +2 -2
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/mlx/chat.py +3 -3
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/format.py +1 -1
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/tinygrad/chat.py +1 -1
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/transformers/transformers.py +1 -1
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/messages.py +2 -2
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/_marshal.py +2 -6
- ommlds-0.0.0.dev368/ommlds/minichain/content/materialize.py +203 -0
- ommlds-0.0.0.dev368/ommlds/minichain/content/placeholders.py +20 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/lib/fs/ls/rendering.py +82 -57
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368/ommlds.egg-info}/PKG-INFO +3 -3
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds.egg-info/SOURCES.txt +1 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds.egg-info/requires.txt +2 -2
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/pyproject.toml +3 -3
- ommlds-0.0.0.dev366/ommlds/minichain/content/materialize.py +0 -112
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/LICENSE +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/MANIFEST.in +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/README.md +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/.manifests.json +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/__about__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/sse/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/sse/assemble.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/sse/events.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/sse/marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/anthropic/protocol/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/llamacpp/buildwheel.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/llamacpp/logging.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/__main__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/caching.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/cli.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/generation.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/limits.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/loading.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/LICENSE +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/detokenization/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/detokenization/base.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/detokenization/bpe.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/detokenization/naive.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/detokenization/spm.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/loading.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/tokenization.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/mlx/tokenization/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/chunk.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/contentpart.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/message.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/request.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/response.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/responseformat.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/chatcompletion/tokenlogprob.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/openai/protocol/completionusage.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/LICENSE +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/__main__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/attention.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/cli.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/fetch.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/llm.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/loading.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/quantization.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/sampling.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/tokenization.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/llama3/transformer.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/__main__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/cli.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/clip.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/sdxl.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/models/sdxl/unet.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/tinygrad/tinygrad.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/torch/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/torch/backends.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/torch/devices.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/backends/torch/purge.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/__main__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/inject.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/main.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/base.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/chat.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/completion.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/embedding.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/sessions/inject.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/state.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/tools/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/tools/inject.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/cli/tools/tools.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/datasets/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/datasets/library/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/datasets/library/movies.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/hacks/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/hacks/patches.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/huggingface.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/_abc.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/_typedvalues.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/anthropic/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/duckduckgo.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/google/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/google/search.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/huggingface.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/llamacpp/chat.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/llamacpp/completion.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/llamacpp/stream.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/mlx/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/chat.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/completion.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/embedding.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/openai/stream.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/sentencepiece/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/sentencepiece/tokens.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/sqlite.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/tinygrad/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/tokenizers/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/tokenizers/tokens.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/transformers/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/transformers/sentence.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/backends/transformers/tokens.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/_marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/choices/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/choices/adapters.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/choices/services.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/choices/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/formats.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/history.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/metadata.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/services.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/stream/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/stream/adapters.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/stream/services.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/stream/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/templating.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/tools.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/transforms/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/transforms/base.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/transforms/uuids.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/chat/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/completion.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/configs.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/images.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/metadata.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/namespaces.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/prepare.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/rendering.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/sequence.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/simple.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/text.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/base.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/interleave.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/squeeze.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/stringify.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/transforms/strings.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/content/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/docs/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/docs/docs.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/docs/dtypes.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/docs/filters.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/envs.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/json.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/lib/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/lib/fs/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/lib/fs/ls/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/lib/fs/ls/running.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/llms/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/llms/_marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/llms/tokens.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/llms/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/metadata.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/registry.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/resources.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/search.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/_marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/_origclasses.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/_typedvalues.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/facades.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/requests.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/responses.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/services/services.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/standard.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/stream/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/stream/services.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/stream/wrap.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/applypatch.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/base.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/dumb.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/LICENSE +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/hermes2.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/llama31.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/text/toolparsing/llamacpp/utils.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tokens/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tokens/specials.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tokens/tokenizers.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tokens/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tokens/vocabs.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tools/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tools/_marshal.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tools/jsonschema.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tools/reflect.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/tools/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/embeddings.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/index.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/search.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/similarity.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/stores.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/minichain/vectors/types.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/__main__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/cli.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/client.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/server.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/server/service.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/tools/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/tools/git.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/tools/ocr.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/analyze.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/convert.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/models.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/text/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/text/mfh.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/text/wtp.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/utils/__init__.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/utils/io.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/utils/progress.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/utils/xml.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds/wiki/xml.py +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds.egg-info/dependency_links.txt +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds.egg-info/entry_points.txt +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/ommlds.egg-info/top_level.txt +0 -0
- {ommlds-0.0.0.dev366 → ommlds-0.0.0.dev368}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev368
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: >=3.13
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omdev==0.0.0.
|
|
16
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omdev==0.0.0.dev368
|
|
16
|
+
Requires-Dist: omlish==0.0.0.dev368
|
|
17
17
|
Provides-Extra: all
|
|
18
18
|
Requires-Dist: llama-cpp-python~=0.3; extra == "all"
|
|
19
19
|
Requires-Dist: mlx~=0.26; extra == "all"
|
|
@@ -137,6 +137,12 @@ from .content.namespaces import ( # noqa
|
|
|
137
137
|
ContentNamespace,
|
|
138
138
|
)
|
|
139
139
|
|
|
140
|
+
from .content.placeholders import ( # noqa
|
|
141
|
+
ContentPlaceholder,
|
|
142
|
+
ContentPlaceholderMarker,
|
|
143
|
+
content_placeholder,
|
|
144
|
+
)
|
|
145
|
+
|
|
140
146
|
from .content.prepare import ( # noqa
|
|
141
147
|
ContentPreparer,
|
|
142
148
|
ContentStrPreparer,
|
|
@@ -56,10 +56,10 @@ class AnthropicChatChoicesService:
|
|
|
56
56
|
self._model_name = cc.pop(ModelName(self.model))
|
|
57
57
|
|
|
58
58
|
def _get_msg_content(self, m: Message) -> str | None:
|
|
59
|
-
if isinstance(m,
|
|
59
|
+
if isinstance(m, AiMessage):
|
|
60
60
|
return m.s
|
|
61
61
|
|
|
62
|
-
elif isinstance(m, UserMessage):
|
|
62
|
+
elif isinstance(m, (UserMessage, SystemMessage)):
|
|
63
63
|
return check.isinstance(m.c, str)
|
|
64
64
|
|
|
65
65
|
else:
|
|
@@ -38,16 +38,16 @@ class GoogleChatChoicesService:
|
|
|
38
38
|
self._api_key = ApiKey.pop_secret(cc, env='GEMINI_API_KEY')
|
|
39
39
|
|
|
40
40
|
def _get_msg_content(self, m: Message) -> str | None:
|
|
41
|
-
if isinstance(m,
|
|
42
|
-
return m.s
|
|
41
|
+
if isinstance(m, AiMessage):
|
|
42
|
+
return check.isinstance(m.s, str)
|
|
43
43
|
|
|
44
|
-
elif isinstance(m, UserMessage):
|
|
44
|
+
elif isinstance(m, (SystemMessage, UserMessage)):
|
|
45
45
|
return check.isinstance(m.c, str)
|
|
46
46
|
|
|
47
47
|
else:
|
|
48
48
|
raise TypeError(m)
|
|
49
49
|
|
|
50
|
-
BASE_URL = 'https://generativelanguage.googleapis.com/v1beta/models'
|
|
50
|
+
BASE_URL: ta.ClassVar[str] = 'https://generativelanguage.googleapis.com/v1beta/models'
|
|
51
51
|
|
|
52
52
|
ROLES_MAP: ta.ClassVar[ta.Mapping[type[Message], str]] = {
|
|
53
53
|
SystemMessage: 'system',
|
|
@@ -21,10 +21,10 @@ ROLES_MAP: ta.Mapping[type[Message], str] = {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def get_msg_content(m: Message) -> str | None:
|
|
24
|
-
if isinstance(m,
|
|
24
|
+
if isinstance(m, AiMessage):
|
|
25
25
|
return m.s
|
|
26
26
|
|
|
27
|
-
elif isinstance(m, UserMessage):
|
|
27
|
+
elif isinstance(m, (SystemMessage, UserMessage)):
|
|
28
28
|
return check.isinstance(m.c, str)
|
|
29
29
|
|
|
30
30
|
else:
|
|
@@ -37,10 +37,10 @@ class MistralChatChoicesService:
|
|
|
37
37
|
self._api_key = api_key
|
|
38
38
|
|
|
39
39
|
def _get_msg_content(self, m: Message) -> str | None:
|
|
40
|
-
if isinstance(m,
|
|
40
|
+
if isinstance(m, AiMessage):
|
|
41
41
|
return m.s
|
|
42
42
|
|
|
43
|
-
elif isinstance(m, UserMessage):
|
|
43
|
+
elif isinstance(m, (UserMessage, SystemMessage)):
|
|
44
44
|
return check.isinstance(m.c, str)
|
|
45
45
|
|
|
46
46
|
else:
|
|
@@ -56,10 +56,10 @@ class MlxChatChoicesService(lang.ExitStacked):
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
def _get_msg_content(self, m: Message) -> str | None:
|
|
59
|
-
if isinstance(m,
|
|
60
|
-
return m.s
|
|
59
|
+
if isinstance(m, AiMessage):
|
|
60
|
+
return check.isinstance(m.s, str)
|
|
61
61
|
|
|
62
|
-
elif isinstance(m, UserMessage):
|
|
62
|
+
elif isinstance(m, (SystemMessage, UserMessage)):
|
|
63
63
|
return check.isinstance(m.c, str)
|
|
64
64
|
|
|
65
65
|
else:
|
|
@@ -47,7 +47,7 @@ class Message( # noqa
|
|
|
47
47
|
|
|
48
48
|
@dc.dataclass(frozen=True)
|
|
49
49
|
class SystemMessage(Message, lang.Final):
|
|
50
|
-
|
|
50
|
+
c: CanContent
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
#
|
|
@@ -94,7 +94,7 @@ Chat: ta.TypeAlias = ta.Sequence[Message]
|
|
|
94
94
|
class _MessageContentTransform(ContentTransform, lang.Final, lang.NotInstantiable):
|
|
95
95
|
@dispatch.install_method(ContentTransform.apply)
|
|
96
96
|
def apply_system_message(self, m: SystemMessage) -> SystemMessage:
|
|
97
|
-
return dc.replace(m,
|
|
97
|
+
return dc.replace(m, c=self.apply(m.c))
|
|
98
98
|
|
|
99
99
|
@dispatch.install_method(ContentTransform.apply)
|
|
100
100
|
def apply_user_message(self, m: UserMessage) -> UserMessage:
|
|
@@ -7,11 +7,10 @@ from omlish import lang
|
|
|
7
7
|
from omlish import marshal as msh
|
|
8
8
|
from omlish import reflect as rfl
|
|
9
9
|
from omlish.funcs import match as mfs
|
|
10
|
-
from omlish.text import templating as tpl
|
|
11
10
|
|
|
12
11
|
from .images import ImageContent # noqa
|
|
13
12
|
from .materialize import CanContent
|
|
14
|
-
from .
|
|
13
|
+
from .materialize import _InnerCanContent
|
|
15
14
|
from .sequence import BlockContent # noqa
|
|
16
15
|
from .sequence import InlineContent # noqa
|
|
17
16
|
from .text import TextContent # noqa
|
|
@@ -88,11 +87,8 @@ class MarshalCanContent(lang.NotInstantiable, lang.Final):
|
|
|
88
87
|
|
|
89
88
|
|
|
90
89
|
MarshalCanContentUnion: ta.TypeAlias = ta.Union[ # noqa
|
|
91
|
-
str,
|
|
92
|
-
ExtendedContent,
|
|
93
90
|
ta.Iterable[MarshalCanContent],
|
|
94
|
-
|
|
95
|
-
tpl.Templater,
|
|
91
|
+
_InnerCanContent,
|
|
96
92
|
]
|
|
97
93
|
|
|
98
94
|
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TODO:
|
|
3
|
+
- ExtendedCanContent
|
|
4
|
+
"""
|
|
5
|
+
import dataclasses as dc
|
|
6
|
+
import typing as ta
|
|
7
|
+
|
|
8
|
+
from omlish import check
|
|
9
|
+
from omlish import dispatch
|
|
10
|
+
from omlish.text import templating as tpl
|
|
11
|
+
|
|
12
|
+
from .namespaces import ContentNamespace
|
|
13
|
+
from .placeholders import ContentPlaceholder
|
|
14
|
+
from .placeholders import ContentPlaceholderMarker
|
|
15
|
+
from .types import Content
|
|
16
|
+
from .types import ExtendedContent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
_InnerCanContent: ta.TypeAlias = ta.Union[ # noqa
|
|
23
|
+
str,
|
|
24
|
+
ExtendedContent,
|
|
25
|
+
|
|
26
|
+
ContentPlaceholder,
|
|
27
|
+
type[ContentPlaceholderMarker],
|
|
28
|
+
|
|
29
|
+
type[ContentNamespace],
|
|
30
|
+
|
|
31
|
+
tpl.Templater,
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
CanContent: ta.TypeAlias = ta.Union[ # noqa
|
|
35
|
+
ta.Iterable['CanContent'],
|
|
36
|
+
|
|
37
|
+
None,
|
|
38
|
+
|
|
39
|
+
_InnerCanContent,
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
ContentPlaceholderKey: ta.TypeAlias = ContentPlaceholder | type[ContentPlaceholderMarker]
|
|
47
|
+
ContentPlaceholderMap: ta.TypeAlias = ta.Mapping[ContentPlaceholderKey, CanContent]
|
|
48
|
+
ContentPlaceholderFn: ta.TypeAlias = ta.Callable[[ContentPlaceholderKey], CanContent]
|
|
49
|
+
ContentPlaceholders: ta.TypeAlias = ContentPlaceholderMap | ContentPlaceholderFn
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dc.dataclass()
|
|
53
|
+
class ContentPlaceholderMissingError(Exception):
|
|
54
|
+
key: ContentPlaceholderKey
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _make_content_placeholder_fn(cps: ContentPlaceholders | None = None) -> ContentPlaceholderFn:
|
|
58
|
+
if cps is None:
|
|
59
|
+
def none_fn(cpk: ContentPlaceholderKey) -> CanContent:
|
|
60
|
+
raise ContentPlaceholderMissingError(cpk)
|
|
61
|
+
|
|
62
|
+
return none_fn
|
|
63
|
+
|
|
64
|
+
elif isinstance(cps, ta.Mapping):
|
|
65
|
+
def mapping_fn(cpk: ContentPlaceholderKey) -> CanContent:
|
|
66
|
+
try:
|
|
67
|
+
return cps[cpk]
|
|
68
|
+
except KeyError:
|
|
69
|
+
raise ContentPlaceholderMissingError(cpk) from None
|
|
70
|
+
|
|
71
|
+
return mapping_fn
|
|
72
|
+
|
|
73
|
+
elif callable(cps):
|
|
74
|
+
return cps
|
|
75
|
+
|
|
76
|
+
else:
|
|
77
|
+
raise TypeError(cps)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class ContentDepthExceededError(Exception):
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ContentMaterializer:
|
|
88
|
+
DEFAULT_MAX_DEPTH: int = 100
|
|
89
|
+
|
|
90
|
+
def __init__(
|
|
91
|
+
self,
|
|
92
|
+
*,
|
|
93
|
+
content_placeholders: ContentPlaceholders | None = None,
|
|
94
|
+
templater_context: tpl.Templater.Context | None = None,
|
|
95
|
+
max_depth: int = DEFAULT_MAX_DEPTH,
|
|
96
|
+
) -> None:
|
|
97
|
+
super().__init__()
|
|
98
|
+
|
|
99
|
+
self._templater_context = templater_context
|
|
100
|
+
self._content_placeholders_fn = _make_content_placeholder_fn(content_placeholders)
|
|
101
|
+
self._max_depth = max_depth
|
|
102
|
+
|
|
103
|
+
self._cur_depth = 0
|
|
104
|
+
|
|
105
|
+
def materialize(self, o: CanContent) -> Content:
|
|
106
|
+
if self._cur_depth >= self._max_depth:
|
|
107
|
+
raise ContentDepthExceededError
|
|
108
|
+
|
|
109
|
+
self._cur_depth += 1
|
|
110
|
+
try:
|
|
111
|
+
return self._materialize(o)
|
|
112
|
+
finally:
|
|
113
|
+
self._cur_depth -= 1
|
|
114
|
+
|
|
115
|
+
@dispatch.method
|
|
116
|
+
def _materialize(self, o: CanContent) -> Content:
|
|
117
|
+
raise TypeError(o)
|
|
118
|
+
|
|
119
|
+
#
|
|
120
|
+
|
|
121
|
+
@_materialize.register
|
|
122
|
+
def _materialize_str(self, o: str) -> Content:
|
|
123
|
+
return o
|
|
124
|
+
|
|
125
|
+
@_materialize.register
|
|
126
|
+
def _materialize_extended_content(self, o: ExtendedContent) -> Content:
|
|
127
|
+
return o
|
|
128
|
+
|
|
129
|
+
#
|
|
130
|
+
|
|
131
|
+
@_materialize.register
|
|
132
|
+
def _materialize_iterable(self, o: ta.Iterable) -> Content:
|
|
133
|
+
return [self.materialize(e) for e in o]
|
|
134
|
+
|
|
135
|
+
@_materialize.register
|
|
136
|
+
def _materialize_none(self, o: None) -> Content:
|
|
137
|
+
return []
|
|
138
|
+
|
|
139
|
+
#
|
|
140
|
+
|
|
141
|
+
@_materialize.register
|
|
142
|
+
def _materialize_placeholder(self, o: ContentPlaceholder) -> Content:
|
|
143
|
+
return self.materialize(self._content_placeholders_fn(o))
|
|
144
|
+
|
|
145
|
+
def _materialize_placeholder_marker_type(self, o: type[ContentPlaceholderMarker]) -> Content:
|
|
146
|
+
check.issubclass(o, ContentPlaceholderMarker)
|
|
147
|
+
return self.materialize(self._content_placeholders_fn(o))
|
|
148
|
+
|
|
149
|
+
#
|
|
150
|
+
|
|
151
|
+
def _materialize_namespace_type(self, o: type[ContentNamespace]) -> Content:
|
|
152
|
+
check.issubclass(o, ContentNamespace)
|
|
153
|
+
|
|
154
|
+
def rec(v: ta.Any) -> ta.Generator[Content]:
|
|
155
|
+
if isinstance(v, (bytes, bytearray, ta.Mapping)):
|
|
156
|
+
return
|
|
157
|
+
|
|
158
|
+
elif isinstance(v, type):
|
|
159
|
+
if issubclass(v, ContentNamespace):
|
|
160
|
+
for n, e in v:
|
|
161
|
+
if n.startswith('_'):
|
|
162
|
+
continue
|
|
163
|
+
yield from rec(e)
|
|
164
|
+
|
|
165
|
+
elif isinstance(v, ta.Iterable):
|
|
166
|
+
for e in v:
|
|
167
|
+
yield from rec(e)
|
|
168
|
+
|
|
169
|
+
else:
|
|
170
|
+
yield self.materialize(v)
|
|
171
|
+
|
|
172
|
+
return list(rec(o))
|
|
173
|
+
|
|
174
|
+
#
|
|
175
|
+
|
|
176
|
+
@_materialize.register
|
|
177
|
+
def _materialize_type(self, o: type) -> Content:
|
|
178
|
+
if issubclass(o, ContentPlaceholderMarker):
|
|
179
|
+
return self._materialize_placeholder_marker_type(o)
|
|
180
|
+
|
|
181
|
+
elif issubclass(o, ContentNamespace):
|
|
182
|
+
return self._materialize_namespace_type(o)
|
|
183
|
+
|
|
184
|
+
else:
|
|
185
|
+
raise TypeError(o)
|
|
186
|
+
|
|
187
|
+
#
|
|
188
|
+
|
|
189
|
+
@_materialize.register
|
|
190
|
+
def _materialize_templater(self, o: tpl.Templater) -> Content:
|
|
191
|
+
return o.render(check.not_none(self._templater_context))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def materialize_content(
|
|
195
|
+
o: CanContent,
|
|
196
|
+
*,
|
|
197
|
+
content_placeholders: ContentPlaceholders | None = None,
|
|
198
|
+
templater_context: tpl.Templater.Context | None = None,
|
|
199
|
+
) -> Content:
|
|
200
|
+
return ContentMaterializer(
|
|
201
|
+
content_placeholders=content_placeholders,
|
|
202
|
+
templater_context=templater_context,
|
|
203
|
+
).materialize(o)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from omlish import dataclasses as dc
|
|
2
|
+
from omlish import lang
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dc.dataclass(frozen=True, eq=False)
|
|
9
|
+
@dc.extra_class_params(repr_id=True)
|
|
10
|
+
class ContentPlaceholder(lang.Final):
|
|
11
|
+
# kw_only to prevent misuse - the string passed to this class is not the Content itself, just the name of the
|
|
12
|
+
# placeholder
|
|
13
|
+
name: str | None = dc.field(default=None, kw_only=True, metadata=dc.extra_field_params(repr_fn=lang.opt_repr))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
content_placeholder = ContentPlaceholder
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ContentPlaceholderMarker(lang.Marker):
|
|
20
|
+
pass
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
TODO:
|
|
3
|
+
- max_depth
|
|
3
4
|
- '...' marker for truncated directories
|
|
5
|
+
- any directory with unlisted children will be suffixed inline with '...'
|
|
6
|
+
- absence of '...' indicates an empty directory
|
|
4
7
|
"""
|
|
5
8
|
import dataclasses as dc
|
|
6
9
|
import typing as ta
|
|
@@ -15,7 +18,16 @@ from .running import LsItem
|
|
|
15
18
|
##
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
class RenderedLsLines(ta.NamedTuple):
|
|
22
|
+
lines: list[str]
|
|
23
|
+
joined_len: int
|
|
24
|
+
is_truncated: bool
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dc.dataclass(eq=False)
|
|
19
31
|
class _LsLine:
|
|
20
32
|
item: LsItem
|
|
21
33
|
d: int
|
|
@@ -30,28 +42,16 @@ class _LsLine:
|
|
|
30
42
|
return f'{self.__class__.__name__}<{self.item.path!r}, {self.s!r}>'
|
|
31
43
|
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
is_truncated: bool
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class LsLinesRenderer:
|
|
40
|
-
def __init__(
|
|
41
|
-
self,
|
|
42
|
-
*,
|
|
43
|
-
soft_max_len: int | None = None,
|
|
44
|
-
) -> None:
|
|
45
|
-
super().__init__()
|
|
46
|
-
|
|
47
|
-
self._soft_max_len = soft_max_len
|
|
45
|
+
@dc.dataclass()
|
|
46
|
+
class _LsRenderRun:
|
|
47
|
+
root: DirLsItem
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
check.state(not root.path.endswith('/'))
|
|
51
|
-
root_pfx = root.path + '/'
|
|
49
|
+
_: dc.KW_ONLY
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
soft_max_len: int | None = None
|
|
54
52
|
|
|
53
|
+
@lang.cached_function
|
|
54
|
+
def root_line(self) -> _LsLine:
|
|
55
55
|
def rec0(cur: LsItem, *, d: int = 0) -> _LsLine:
|
|
56
56
|
if isinstance(cur, DirLsItem):
|
|
57
57
|
return _LsLine(
|
|
@@ -69,10 +69,10 @@ class LsLinesRenderer:
|
|
|
69
69
|
d,
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
#
|
|
72
|
+
return rec0(self.root)
|
|
75
73
|
|
|
74
|
+
@lang.cached_function
|
|
75
|
+
def all_lines(self) -> ta.Sequence[_LsLine]:
|
|
76
76
|
all_lines: list[_LsLine] = []
|
|
77
77
|
|
|
78
78
|
def rec1(cur: _LsLine) -> None:
|
|
@@ -81,10 +81,39 @@ class LsLinesRenderer:
|
|
|
81
81
|
for child in cur.children.values():
|
|
82
82
|
rec1(child)
|
|
83
83
|
|
|
84
|
-
rec1(root_line)
|
|
84
|
+
rec1(self.root_line())
|
|
85
|
+
return all_lines
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
def render_item(self, item: LsItem) -> str:
|
|
88
|
+
root_pfx = self.root.path + '/'
|
|
89
|
+
|
|
90
|
+
if item.path == self.root.path:
|
|
91
|
+
return f'- {self.root.path}'
|
|
92
|
+
|
|
93
|
+
else:
|
|
94
|
+
return (
|
|
95
|
+
f'{" " * (lang.strip_prefix(item.path, root_pfx).count("/") + 1)}'
|
|
96
|
+
f'- {item.name}'
|
|
97
|
+
f'{"/" if isinstance(item, DirLsItem) else ""}'
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def collect_lines(self) -> list[str]:
|
|
101
|
+
ret: list[str] = []
|
|
87
102
|
|
|
103
|
+
def rec2(cur: _LsLine) -> None:
|
|
104
|
+
if cur.s is None:
|
|
105
|
+
return
|
|
106
|
+
|
|
107
|
+
ret.append(cur.s)
|
|
108
|
+
|
|
109
|
+
if cur.children is not None:
|
|
110
|
+
for child in cur.children.values():
|
|
111
|
+
rec2(child)
|
|
112
|
+
|
|
113
|
+
rec2(self.root_line())
|
|
114
|
+
return ret
|
|
115
|
+
|
|
116
|
+
def run(self) -> RenderedLsLines:
|
|
88
117
|
cur_len = 0
|
|
89
118
|
|
|
90
119
|
def add_line(s: str, *, force: bool = False) -> str | None:
|
|
@@ -93,7 +122,7 @@ class LsLinesRenderer:
|
|
|
93
122
|
nonlocal cur_len
|
|
94
123
|
sl = len(s) + (1 if cur_len else 0)
|
|
95
124
|
|
|
96
|
-
if not force and (self.
|
|
125
|
+
if not force and (self.soft_max_len is not None and (cur_len + sl) > self.soft_max_len):
|
|
97
126
|
return None
|
|
98
127
|
|
|
99
128
|
cur_len += sl
|
|
@@ -101,26 +130,14 @@ class LsLinesRenderer:
|
|
|
101
130
|
|
|
102
131
|
#
|
|
103
132
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return f'- {root.path}'
|
|
107
|
-
|
|
108
|
-
else:
|
|
109
|
-
return (
|
|
110
|
-
f'{" " * (lang.strip_prefix(item.path, root_pfx).count("/") + 1)}'
|
|
111
|
-
f'- {item.name}'
|
|
112
|
-
f'{"/" if isinstance(item, DirLsItem) else ""}'
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
#
|
|
116
|
-
|
|
117
|
-
root_line.s = add_line(render_item(root_line.item), force=True)
|
|
133
|
+
root_line = self.root_line()
|
|
134
|
+
root_line.s = add_line(self.render_item(root_line.item), force=True)
|
|
118
135
|
|
|
119
136
|
for root_child in check.not_none(root_line.children).values():
|
|
120
|
-
root_child.s = add_line(render_item(root_child.item), force=True)
|
|
137
|
+
root_child.s = add_line(self.render_item(root_child.item), force=True)
|
|
121
138
|
|
|
122
139
|
sorted_lines = sorted(
|
|
123
|
-
all_lines,
|
|
140
|
+
self.all_lines(),
|
|
124
141
|
key=lambda line: (line.children is None, line.d),
|
|
125
142
|
)
|
|
126
143
|
|
|
@@ -130,7 +147,7 @@ class LsLinesRenderer:
|
|
|
130
147
|
if cur.s is not None:
|
|
131
148
|
continue
|
|
132
149
|
|
|
133
|
-
s = add_line(render_item(cur.item))
|
|
150
|
+
s = add_line(self.render_item(cur.item))
|
|
134
151
|
if s is None:
|
|
135
152
|
is_truncated = True
|
|
136
153
|
break
|
|
@@ -139,22 +156,30 @@ class LsLinesRenderer:
|
|
|
139
156
|
|
|
140
157
|
#
|
|
141
158
|
|
|
142
|
-
|
|
159
|
+
return RenderedLsLines(
|
|
160
|
+
self.collect_lines(),
|
|
161
|
+
cur_len,
|
|
162
|
+
is_truncated,
|
|
163
|
+
)
|
|
143
164
|
|
|
144
|
-
def rec2(cur: _LsLine) -> None:
|
|
145
|
-
if cur.s is None:
|
|
146
|
-
return
|
|
147
165
|
|
|
148
|
-
|
|
166
|
+
#
|
|
149
167
|
|
|
150
|
-
if cur.children is not None:
|
|
151
|
-
for child in cur.children.values():
|
|
152
|
-
rec2(child)
|
|
153
168
|
|
|
154
|
-
|
|
169
|
+
class LsLinesRenderer:
|
|
170
|
+
def __init__(
|
|
171
|
+
self,
|
|
172
|
+
*,
|
|
173
|
+
soft_max_len: int | None = None,
|
|
174
|
+
) -> None:
|
|
175
|
+
super().__init__()
|
|
176
|
+
|
|
177
|
+
self._soft_max_len = soft_max_len
|
|
155
178
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
179
|
+
def render(self, root: DirLsItem) -> RenderedLsLines:
|
|
180
|
+
check.state(not root.path.endswith('/'))
|
|
181
|
+
|
|
182
|
+
return _LsRenderRun(
|
|
183
|
+
root,
|
|
184
|
+
soft_max_len=self._soft_max_len,
|
|
185
|
+
).run()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev368
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: >=3.13
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omdev==0.0.0.
|
|
16
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omdev==0.0.0.dev368
|
|
16
|
+
Requires-Dist: omlish==0.0.0.dev368
|
|
17
17
|
Provides-Extra: all
|
|
18
18
|
Requires-Dist: llama-cpp-python~=0.3; extra == "all"
|
|
19
19
|
Requires-Dist: mlx~=0.26; extra == "all"
|
|
@@ -169,6 +169,7 @@ ommlds/minichain/content/images.py
|
|
|
169
169
|
ommlds/minichain/content/materialize.py
|
|
170
170
|
ommlds/minichain/content/metadata.py
|
|
171
171
|
ommlds/minichain/content/namespaces.py
|
|
172
|
+
ommlds/minichain/content/placeholders.py
|
|
172
173
|
ommlds/minichain/content/prepare.py
|
|
173
174
|
ommlds/minichain/content/rendering.py
|
|
174
175
|
ommlds/minichain/content/sequence.py
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
|
14
14
|
requires-python = '>=3.13'
|
|
15
|
-
version = '0.0.0.
|
|
15
|
+
version = '0.0.0.dev368'
|
|
16
16
|
classifiers = [
|
|
17
17
|
'License :: OSI Approved :: BSD License',
|
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
|
@@ -22,8 +22,8 @@ classifiers = [
|
|
|
22
22
|
]
|
|
23
23
|
description = 'ommlds'
|
|
24
24
|
dependencies = [
|
|
25
|
-
'omdev == 0.0.0.
|
|
26
|
-
'omlish == 0.0.0.
|
|
25
|
+
'omdev == 0.0.0.dev368',
|
|
26
|
+
'omlish == 0.0.0.dev368',
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.optional-dependencies]
|