mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 10:53:02 +01:00
Update Advanced Usage section in main Readme
- Update Khoj PWA image to show Khoj open as PWA on Android - Add section to show configuring Khoj to use OpenAI models for search
This commit is contained in:
parent
26f791e9ad
commit
2fe21f3a78
2 changed files with 38 additions and 2 deletions
40
Readme.md
40
Readme.md
|
@ -27,6 +27,7 @@
|
|||
- [Troubleshoot](#Troubleshoot)
|
||||
- [Advanced Usage](#advanced-usage)
|
||||
- [Access Khoj on Mobile](#access-khoj-on-mobile)
|
||||
- [Use OpenAI Models for Search](#use-openai-models-for-search)
|
||||
- [Miscellaneous](#Miscellaneous)
|
||||
- [Performance](#Performance)
|
||||
- [Query Performance](#Query-performance)
|
||||
|
@ -182,12 +183,47 @@ pip install --upgrade khoj-assistant
|
|||
## Access Khoj on Mobile
|
||||
1. [Setup Khoj](#Setup) on your personal server. This can be any always-on machine, i.e an old computer, RaspberryPi(?) etc
|
||||
2. [Install](https://tailscale.com/kb/installation/) [Tailscale](tailscale.com/) on your personal server and phone
|
||||
3. Open the Khoj web interface of the server from your phone browser. It should be `http://tailscale-url-of-server:8000` or `http://name-of-server:8000` if you've setup [MagicDNS](https://tailscale.com/kb/1081/magicdns/)
|
||||
4. Click the [Install/Add to Homescreen](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Add_to_home_screen) button
|
||||
3. Open the Khoj web interface of the server from your phone browser.<br /> It should be `http://tailscale-url-of-server:8000` or `http://name-of-server:8000` if you've setup [MagicDNS](https://tailscale.com/kb/1081/magicdns/)
|
||||
4. Click the [Add to Homescreen](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Add_to_home_screen) button
|
||||
5. Enjoy exploring your notes, transactions and images from your phone!
|
||||
|
||||
![](https://github.com/debanjum/khoj/blob/master/docs/khoj_pwa_android.png)
|
||||
|
||||
## Use OpenAI Models for Search
|
||||
**Warnings**
|
||||
- This configuration *uses an online model*
|
||||
- It will **send all notes to OpenAI** to generate embeddings
|
||||
- **All queries will be sent to OpenAI** when you search with Khoj
|
||||
- *Requires an active internet connection* to search and index
|
||||
- You will be **charged by OpenAI** based on the total tokens processed
|
||||
|
||||
**Setup**
|
||||
1. Set `encoder-type`, `encoder` and `model-directory` under `asymmetric` and/or `symmetric` `search-type` in your `khoj.yml`[^1]:
|
||||
```diff
|
||||
asymmetric:
|
||||
- encoder: "sentence-transformers/multi-qa-MiniLM-L6-cos-v1"
|
||||
+ encoder: text-embedding-ada-002
|
||||
+ encoder-type: src.utils.models.OpenAI
|
||||
cross-encoder: "cross-encoder/ms-marco-MiniLM-L-6-v2"
|
||||
- encoder-type: sentence_transformers.SentenceTransformer
|
||||
- model_directory: "~/.khoj/search/asymmetric/"
|
||||
+ model-directory: null
|
||||
```
|
||||
|
||||
2. Set `openai-api-key` field under `processor.conversation` section in your `khoj.yml`[^1] is set to your [OpenAI API key](https://beta.openai.com/account/api-keys):
|
||||
```diff
|
||||
processor:
|
||||
conversation:
|
||||
- openai-api-key: # "YOUR_OPENAI_API_KEY"
|
||||
+ openai-api-key: sk-aaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhh
|
||||
model: "text-davinci-003"
|
||||
conversation-logfile: "~/.khoj/processor/conversation/conversation_logs.json"
|
||||
```
|
||||
|
||||
3. Restart Khoj server to generate embeddings. It will take longer than with offline models.
|
||||
|
||||
[^1]: By default @ `~/.khoj/khoj.yml`
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
- The beta [chat](http://localhost:8000/api/beta/chat) and [search](http://localhost:8000/api/beta/search) API endpoints use [OpenAI API](https://openai.com/api/)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 445 KiB |
Loading…
Reference in a new issue