Categories:
Modify prompts using ConfigMap
Guidelines valid for releases previous to Metallica
This document includes a specific scenario in the process of modifying ATRIA prompts, described in the document Modify ATRIA components configuration
Guidelines to modify the Aura prompts in a specific environment through the use of ConfigMap.
It is important to follow the following steps in the correct order:
Prerequisites
- Recommended:
kubectlinstalled in your local host.curlinstalled in your local host.jqinstalled in your local host.
Enable ConfigMap
As a prerequisite, we must count on a KUBECONFIG with sufficient permissions and access to the environment.
We have one ConfigMap for each component:
- atria-model-gateway: atria-model-gw-config
- atria-rag-server: atria-rag-config
For the ConfigMap modification, use the following examples for atria-model-gateway and atria-rag-server respectively:
kubectl edit configmap atria-model-gw-config -n <namespace>kubectl edit configmap atria-rag-config -n <namespace>
(Substitute <namespace> with the corresponding environment)
You can also use visual tools for this modification, such as Lens or Sublime.
Access to Azure container
You must have access to Azure container atria-resources.
Create ConfigMap copy
Important: Before modifying anything, it is highly recommended to make a backup of the ConfigMap content, as the format is very sensitive
To avoid possible errors, the first thing to do is to copy the current configuration. For this purpose, execute the following commands:
kubectl get cm atria-model-gw-config -o yaml -n <namespace> > <local_file_path>/model-gw-config.yamlkubectl get cm atria-rag-config -o yaml -n <namespace> > <local_file_path>/rag-config.yaml
Change the namespace by the specific one; change local_file_path by the desired path.
Now you have a copy of the current configuration on your local machine.
Modify prompt in atria-model-gateway
Follow these guidelines for adding a new preset in a specific environment through the edition of the ConfigMap of the component:
- Open the ConfigMap atria-model-gw-config
kubectl edit configmap atria-model-gw-config -n <namespace>
(Change<namespace>by the specific one)
Warning: If the presets.yml key is wrongly formatted as a single string, it is necessary to launch the command:
kubectl get cm atria-model-gw-config -n <namespace> -o jsonpath='{.data.presets.yml}'
Afterwards, copy the output and overwrite the whole presets.yml key. This way, you can see the content correctly and include the new preset.
-
In the key presets, within openai-preset-gpt-4o-example-generative preset, modify the preamble key with the new prompt.
- description: Atria Example Generate Response GPT4o group: simple_ai id: openai-preset-gpt-4o-example-generative model_id: gpt-4o name: Atria Example with model GPT 4o session_params: window: 0 preamble: - <INSERT THE NEW PROMPT> query_args: query: '' data: '' max_input_length: 50000 model_params: temperature: - 0.001 - 0.001 - 1.0 top_p: - null - 0.0 - 1.0 -
Save and close the ConfigMap
Modify presets name in atria-model-gateway
Follow these guidelines for changing a name of preset in a specific environment through the edition of the ConfigMap of the component:
- Open the ConfigMap atria-model-gw-config
kubectl edit configmap atria-model-gw-config -n <namespace>
(Change<namespace>by the specific one)
Warning: If the presets.yml key is wrongly formatted as a single string, it is necessary to launch the command:
kubectl get cm atria-model-gw-config -n <namespace> -o jsonpath='{.data.presets.yml}'
Afterwards, copy the output and overwrite the whole presets.yml key. This way, you can see the content correctly and change the name.
-
In the key presets, within example-preset-rag preset, modify the name key with the same value as the id (example-preset-rag).
- id: example-preset-rag model_id: atria-rag name: example-preset-rag group: enriched_ai description: A RAG system built on a LangChain backend session_params: window: 0 preset_params: chain: project-example model_params: max_ref: 3 sticky_context: null candidates_post_filtering: null language: en max_tokens: 16384 -
In the key presets, within example-reduced-preset-rag preset, modify the name key with the same value as the id (*example-reduced-preset-rag).
- id: example-reduced-preset-rag model_id: example-reduced-preset-rag name: Example group: enriched_ai description: A RAG system built on a LangChain backend session_params: window: 0 preset_params: chain: project-example-reduced model_params: max_ref: 3 sticky_context: null candidates_post_filtering: null language: en max_tokens: 16384 -
Save and close the ConfigMap
Modify prompt in atria-rag-server
Follow these guidelines to modify the project-example-reduced prompt in a specific environment through the edition of the ConfigMap of the component:
(The project-example-reduced prompt is used in the example-reduced-preset-rag preset)
- Open the ConfigMap atria-rag-config
kubectl edit configmap atria-rag-config -n <namespace>
(Change<namespace>by the specific one)
Warning: If the projects.yaml.project key is wrongly formatted as a single string, it is necessary to launch the following command:
kubectl get cm atria-rag-config -n <namespace> -o jsonpath='{.data.projects\.yaml\.project}'
Afterwards, copy the output and overwrite the whole projects.yaml.project key. This way, you can see the content correctly and modify the corresponding prompt.
-
In the key projects.yaml.project, inside the project-example-reduced project, modify the prompt.
Project structure
project-example-reduced: name: Project Example docs: json: dir: /opt/atria-rag/data/project-example-reduced/jsonl extensions: jsonl loader: jsonl embeddings: test_distilbert llm: example-rag-model-gw-raw-gpt-4-o solve_type: sql retrievers: qdrant: host: qdrant.aura-system port: 6333 collection_name: project-example-reduced-Aura prefix: es-pre-970 tfidf: dump_name: /var/atria-rag-data/tfidf/dump/project-example-reduced-Aura serving: base_url: project-example-reduced/jsonl parameters: candidate_only: false prompts: generate_sql_query: DEFAULT: | <INSERT THE NEW PROMPT>
Some considerations to keep in mind:
. Make sure that the LLM example-rag-model-gw-raw-gpt-4-o is defined within the LLMs field.
. In turn, the preset defined within this LLM must be also defined in the ConfigMap atria-model-gw-config.
- Save and close the ConfigMap
Upload documents and execute generate-db job
This step is only necessary if you have uploaded new files.
Follow the guidelines for uploading new or modified documents in a specific environment through the edition of the ConfigMap of the component (included in the general guidelines Import documents into ATRIA).
- Upload the documents in the Azure container
atria-resources.
- Remember to upload the files to the folder you defined previously in the config project-example-reduced/jsonl
- Keep in mind the allowed formats for documents, set in the project’s variable
loader.
- Finally, execute the atria-rag-generate-db job to update the data into the environment.
Restart the deployments
-
Restart atria-rag-server deployment for the pod to be updated with the changes.
kubectl rollout restart deployment atria-rag -n <namespace> -
Restart atria-model-gateway deployment for the pod to be updated with the changes.
kubectl rollout restart deployment atria-model-gw -n <namespace>
(Change <namespace> by the specific one)
Load original config and deployments rollback
In case you want to return to the original configuration, the following steps must be carried out:
-
Load the original ConfigMap atria-model-gw-config.
kubectl apply -f <local_file_path>/model-gw-config.yaml -n <namespace> -
Load the original ConfigMap atria-rag-config.
kubectl apply -f <local_file_path>/rag-config.yaml -n <namespace>
(Change <namespace> by the specific one; change local_file_path by the desired path)
-
Restart atria-model-gateway deployment for the pod to be updated with the changes.
kubectl rollout restart deployment atria-model-gw -n <namespace> -
Restart atria-rag-server deployment for the pod to be updated with the changes.
kubectl rollout restart deployment atria-rag -n <namespace>
(Change <namespace> by the specific one)