Skip to content

Commit

Permalink
ElasticSearch backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Krisseck committed Nov 5, 2023
1 parent 849ac50 commit 75f10ec
Show file tree
Hide file tree
Showing 8 changed files with 480 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .idea/php-rag.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,28 @@ If you are not using DDEV, you will need:

- SOLR_HOST - Hostname of Solr server
- SOLR_PORT - Port of Solr server
- SOLR_CORE - Name of the core of the Solr server
- SOLR_CORE - Name of the core of the Solr server
- ELASTIC_HOST - Hostname and port of Elastic server
- ELASTIC_API_KEY - API key of Elastic server
- ELASTIC_INDEX - Name of the index of the Elastic server
- CONTEXT_TOKEN_COUNT - Maximum token count to be included in LLM context
- REPLICATE_API_KEY - Replicate API key (if using Replicate LLM)
- REPLICATE_MODEL_VERSION - Hash of the model version used in Replicate (if using Replicate LLM)
- KOBOLDAI_HORDE_API_KEY - KoboldAI Horde API key (if using KoboldAI Horde LLM)

### Backend (database)

Currently only supports Solr server. But more backends (like SQL or Elasticsearch) can be done easily, just implement the `Krisseck\PhpRag\Backend\BackendInterface`.
- Solr
- ElasticSearch

More backends (like MySQL or Sqlite) can be done easily, just implement the `Krisseck\PhpRag\Backend\BackendInterface`.

### LLM

Supports both Replicate and KoboldAI LLM services. Replicate is easier to use, you can get a free API key on https://replicate.com/.
- Replicate
- KoboldAI Horde

Replicate is easier to use, you can get a free API key on https://replicate.com/.

For Replicate, you need to provide the hash of the model version you will be using. You can get the hash from "Versions" tab on a model's page.

Expand Down
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"guzzlehttp/guzzle": "^7.8",
"vlucas/phpdotenv": "^5.5",
"symfony/event-dispatcher": "^6.3",
"yethee/tiktoken": "^0.2.0"
"yethee/tiktoken": "^0.2.0",
"elasticsearch/elasticsearch": "^8.10"
},
"autoload": {
"psr-4": {
Expand All @@ -17,5 +18,10 @@
"name": "Kristian Polso",
"email": "[email protected]"
}
]
],
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
Loading

0 comments on commit 75f10ec

Please sign in to comment.