mirror of
https://github.com/Hopiu/llm.git
synced 2026-03-16 20:50:25 +00:00
parent
0ef5037b00
commit
562fefb374
1 changed files with 4 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ You can load an embedding model using its model ID or alias like this:
|
|||
```python
|
||||
import llm
|
||||
|
||||
embedding_model = llm.get_embedding_model("ada-002")
|
||||
embedding_model = llm.get_embedding_model("3-small")
|
||||
```
|
||||
To embed a string, returning a Python list of floating point numbers, use the `.embed()` method:
|
||||
```python
|
||||
|
|
@ -45,14 +45,14 @@ import llm
|
|||
|
||||
# This collection will use an in-memory database that will be
|
||||
# discarded when the Python process exits
|
||||
collection = llm.Collection("entries", model_id="ada-002")
|
||||
collection = llm.Collection("entries", model_id="3-small")
|
||||
|
||||
# Or you can persist the database to disk like this:
|
||||
db = sqlite_utils.Database("my-embeddings.db")
|
||||
collection = llm.Collection("entries", db, model_id="ada-002")
|
||||
collection = llm.Collection("entries", db, model_id="3-small")
|
||||
|
||||
# You can pass a model directly using model= instead of model_id=
|
||||
embedding_model = llm.get_embedding_model("ada-002")
|
||||
embedding_model = llm.get_embedding_model("3-small")
|
||||
collection = llm.Collection("entries", db, model=embedding_model)
|
||||
```
|
||||
If the collection already exists in the database you can omit the `model` or `model_id` argument - the model ID will be read from the `collections` table.
|
||||
|
|
|
|||
Loading…
Reference in a new issue