Skip to content

Commit

Permalink
feat: move conf files under conf folder and added _READ_ index conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal committed Sep 9, 2024
1 parent cb88234 commit dc337e0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ gpt-values-override-conf.*.sh
!gpt-values-override-conf.dist.sh
out/*
!out/.gitkeep
conf/*
!conf/.gitkeep
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ curl -X POST "localhost:9200/_security/api_key?pretty" -H 'Content-Type: applica

### 4. Configure Environment Variables

Copy the `gpt-values-override-conf.dist.sh` file and replace `dist` with the ID you want. Set the needed values in the new file.
Copy the `gpt-values-override-conf.dist.sh` file inside the `conf` folder, and replace `dist` with the ID you want. Set the needed values in the new file.

Example:
```sh
cp gpt-values-override-conf.dist.sh gpt-values-override-conf.myid.sh
cp gpt-values-override-conf.dist.sh conf/gpt-values-override-conf.myid.sh
```

Edit `gpt-values-override-conf.myid.sh` and set your values
Expand Down
9 changes: 8 additions & 1 deletion generate-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,18 @@ process_conf_file() {
envsubst <gpt-schema.dist.yml >"out/$my_id.gpt-schema.yml"
envsubst <gpt-instructions.dist.md >"out/$my_id.gpt-instructions.md"

# Reset the variables
for var in "${dist_vars[@]}"; do
if [ -n "$var" ]; then
unset "$var"
fi
done

echo "Files $my_id.gpt-schema.yml and $my_id.gpt-instructions.md have been generated."
}

# Loop over all configuration files, skipping the .dist.sh file
for conf_file in gpt-values-override-conf.*.sh; do
for conf_file in conf/gpt-values-override-conf.*.sh; do
# Skip the .dist.sh file
if [[ "$conf_file" == *".dist.sh" ]]; then
continue
Expand Down
10 changes: 5 additions & 5 deletions gpt-schema.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ servers:
- url: ${AI_MEMORY_ELASTIC_SEARCH_URL}

paths:
/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}/_doc/:
/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX}/_doc/:
post:
summary: Add a new document. The content field is always required.
operationId: addDocument
Expand Down Expand Up @@ -40,7 +40,7 @@ paths:
schema:
$ref: "#/components/schemas/Error"

"/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}/_update/{id}":
"/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX}/_update/{id}":
post:
summary: Update a document by ID
operationId: updateDocument
Expand Down Expand Up @@ -70,7 +70,7 @@ paths:
schema:
$ref: "#/components/schemas/Error"

/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}/_update_by_query:
/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX}/_update_by_query:
post:
summary: Bulk update documents by query
operationId: bulkUpdateDocuments
Expand Down Expand Up @@ -114,7 +114,7 @@ paths:
schema:
$ref: "#/components/schemas/Error"

/index-ai-memory-*/_search:
/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_READ_INDEX_SUFFIX}/_search:
post:
summary: Search for documents
operationId: searchDocuments
Expand Down Expand Up @@ -200,7 +200,7 @@ paths:
schema:
$ref: "#/components/schemas/Error"

/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}/_mapping:
/index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX}/_mapping:
put:
summary: Configure the index with custom mappings
operationId: configureIndex
Expand Down
12 changes: 9 additions & 3 deletions gpt-values-override-conf.dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
# Example: https://your-elastic-search-url
export AI_MEMORY_ELASTIC_SEARCH_URL="https://your-elastic-search-url"

# Elasticsearch index name
# This is the sufffix of the index where the documents will be stored
# Elasticsearch write index name
# This is the suffix of the index where the documents will be stored
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}
# Example: default
export AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX="default"
export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX="default"

# Elasticsearch read index name
# This is the suffix of the index where the documents will be read from
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}
# Example: default
export AI_MEMORY_ELASTIC_SEARCH_READ_INDEX_SUFFIX=*

# Personal name
# This is the name that will be used in the model's responses
Expand Down

0 comments on commit dc337e0

Please sign in to comment.