Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c2a234a

Browse filesBrowse files
committed
docs: Add embeddings section
1 parent f736827 commit c2a234a
Copy full SHA for c2a234a

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,22 @@ llama = Llama(
398398
)
399399
```
400400

401+
### Embeddings
402+
403+
`llama-cpp-python` supports generating embeddings from the text.
404+
405+
```python
406+
import llama_cpp
407+
408+
llm = llama_cpp.Llama(model_path="path/to/model.gguf", embeddings=True)
409+
410+
embeddings = llm.create_embedding("Hello, world!")
411+
412+
# or batched
413+
414+
embeddings = llm.create_embedding(["Hello, world!", "Goodbye, world!"])
415+
```
416+
401417
### Adjusting the Context Window
402418

403419
The context window of the Llama models determines the maximum number of tokens that can be processed at once. By default, this is set to 512 tokens, but can be adjusted based on your requirements.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.