diff --git a/README.md b/README.md index a58782f..d7f7c24 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,6 @@ See also [the llm tag](https://simonwillison.net/tags/llm/) on my blog. * [SQL schema](https://llm.datasette.io/en/stable/embeddings/python-api.html#sql-schema) * [Writing plugins to add new embedding models](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html) * [Embedding binary content](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html#embedding-binary-content) - * [LLM_RAISE_ERRORS](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html#llm-raise-errors) * [Embedding storage format](https://llm.datasette.io/en/stable/embeddings/storage.html) * [Plugins](https://llm.datasette.io/en/stable/plugins/index.html) * [Installing plugins](https://llm.datasette.io/en/stable/plugins/installing-plugins.html) @@ -281,6 +280,7 @@ See also [the llm tag](https://simonwillison.net/tags/llm/) on my blog. * [Attachments for multi-modal models](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#attachments-for-multi-modal-models) * [Tracking token usage](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#tracking-token-usage) * [Tracking resolved model names](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#tracking-resolved-model-names) + * [LLM_RAISE_ERRORS](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#llm-raise-errors) * [Utility functions for plugins](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html) * [llm.get_key()](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html#llm-get-key) * [llm.user_dir()](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html#llm-user-dir) diff --git a/docs/embeddings/writing-plugins.md b/docs/embeddings/writing-plugins.md index 86c070d..0e5cd0f 100644 --- a/docs/embeddings/writing-plugins.md +++ b/docs/embeddings/writing-plugins.md @@ -66,18 +66,3 @@ class ClipEmbeddingModel(llm.EmbeddingModel): If your model accepts binary, your `.embed_batch()` model may be called with a list of Python bytestrings. These may be mixed with regular strings if the model accepts both types of input. [llm-clip](https://github.com/simonw/llm-clip) is an example of a model that can embed both binary and text content. - -## LLM_RAISE_ERRORS - -While working on a plugin it can be useful to request that errors are raised instead of being caught and logged, so you can access them from the Python debugger. - -Set the `LLM_RAISE_ERRORS` environment variable to enable this behavior, then run `llm` like this: - -```bash -LLM_RAISE_ERRORS=1 python -i -m llm ... -``` -The `-i` option means Python will drop into an interactive shell if an error occurs. You can then open a debugger at the most recent error using: - -```python -import pdb; pdb.pm() -``` \ No newline at end of file diff --git a/docs/plugins/advanced-model-plugins.md b/docs/plugins/advanced-model-plugins.md index 6a681b0..2f2f58a 100644 --- a/docs/plugins/advanced-model-plugins.md +++ b/docs/plugins/advanced-model-plugins.md @@ -290,4 +290,21 @@ If those APIs return the _real_ model ID that was used, your plugin can record t ```bash response.set_resolved_model(resolved_model_id) ``` -This string will be recorded in the database and shown in the output of `llm logs` and `llm logs --json`. \ No newline at end of file +This string will be recorded in the database and shown in the output of `llm logs` and `llm logs --json`. + +(tutorial-model-plugin-raise-errors)= + +## LLM_RAISE_ERRORS + +While working on a plugin it can be useful to request that errors are raised instead of being caught and logged, so you can access them from the Python debugger. + +Set the `LLM_RAISE_ERRORS` environment variable to enable this behavior, then run `llm` like this: + +```bash +LLM_RAISE_ERRORS=1 python -i -m llm ... +``` +The `-i` option means Python will drop into an interactive shell if an error occurs. You can then open a debugger at the most recent error using: + +```python +import pdb; pdb.pm() +``` \ No newline at end of file