mirror of
https://github.com/Hopiu/llm.git
synced 2026-03-17 05:00:25 +00:00
Move LLM_RAISE_ERRORS to advanced model plugins, closes #1121
This commit is contained in:
parent
b858b0083e
commit
f2cf81e29a
3 changed files with 19 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
```
|
||||
|
|
@ -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`.
|
||||
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()
|
||||
```
|
||||
Loading…
Reference in a new issue