|
| 1 | +// Module included in the following assemblies: |
| 2 | +// * lightspeed-docs-main/configure/ols-configuring-openshift-lightspeed.adoc |
| 3 | + |
| 4 | +:_mod-docs-content-type: PROCEDURE |
| 5 | +[id="providing-custom-knowledge-to-the-llm_{context}"] |
| 6 | += Providing custom knowledge to the LLM |
| 7 | + |
| 8 | +Customize the information available to the large language model (LLM) by providing access to a container image that resides in a remote image registry. The examples in this procedure use `quay.io` as the remote container image registry, and the path for the custom image is `quay.io/<username>/my-byok-image:latest`. |
| 9 | + |
| 10 | +:FeatureName: The BYO Knowledge tool |
| 11 | +include::snippets/technology-preview.adoc[] |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | + |
| 15 | +* You are logged in to the {ocp-product-title} web console as a user account that has permission to create a cluster-scoped custom resource (CR) file, such as a user with the `cluster-admin` role. |
| 16 | +
|
| 17 | +* You have installed the {ols-long} Operator. |
| 18 | +
|
| 19 | +* You have configured the LLM provider. |
| 20 | +
|
| 21 | +* The custom information you want to add resides as a collection of Markdown files. No other file format is supported. |
| 22 | +
|
| 23 | +* You have an account for a container image registry, such as `quay.io`. |
| 24 | +
|
| 25 | +.Procedure |
| 26 | + |
| 27 | +. Specify the location of the directory with the Markdown files for the retrieval-augmented generation (RAG) database and the path for the image that the BYO Knowledge tool generates by running the following command: |
| 28 | ++ |
| 29 | +[source,terminal] |
| 30 | +---- |
| 31 | +$ podman run -it --rm --device=/dev/fuse \ |
| 32 | + -v $XDG_RUNTIME_DIR/containers/auth.json:/run/user/0/containers/auth.json:Z \ |
| 33 | + -v <dir_tree_with_markdown_files>:/markdown:Z \ |
| 34 | + -v <dir_for_image_tar>:/output:Z \ |
| 35 | + registry.redhat.io/openshift-lightspeed-tech-preview/lightspeed-rag-tool-rhel9:latest |
| 36 | +---- |
| 37 | ++ |
| 38 | +[NOTE] |
| 39 | +==== |
| 40 | +The container image that the tool generates contains a custom RAG database. The RAG database provides additional information to the LLM. |
| 41 | +==== |
| 42 | + |
| 43 | +. Load the container image that the BYO Knowledge tool generated by running the following command: |
| 44 | ++ |
| 45 | +[source,terminal] |
| 46 | +---- |
| 47 | +$ podman load < <directory_for_image_tar>/<my-byok-image.tar> |
| 48 | +---- |
| 49 | + |
| 50 | +. Display the podman images that are on your local computer by running the following command: |
| 51 | ++ |
| 52 | +[source,terminal] |
| 53 | +---- |
| 54 | +$ podman images |
| 55 | +---- |
| 56 | ++ |
| 57 | +.Example output |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +REPOSITORY TAG IMAGE ID CREATED SIZE |
| 61 | +localhost/my-byok-image latest be7d1770bf10 1 minute ago 2.37 GB |
| 62 | +... |
| 63 | +---- |
| 64 | + |
| 65 | +. Tag the local image with a name and destination so that the image can be pushed to the container image registry by running the following command: |
| 66 | ++ |
| 67 | +[source,terminal] |
| 68 | +---- |
| 69 | +$ podman tag localhost/my-byok-image:latest quay.io/<username>/my-byok-image:latest |
| 70 | +---- |
| 71 | + |
| 72 | +. Push the local container image to the container image registry by running the following command: |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +$ podman push quay.io/<username>/my-byok-image:latest |
| 77 | +---- |
| 78 | + |
| 79 | +. Modify the `OLSconfig` CR to deploy the newly created RAG database alongside the existing one: |
| 80 | + |
| 81 | +.. In the {ocp-product-title} web console, click *Operators* -> *Installed Operators*. |
| 82 | + |
| 83 | +.. Select *All Projects* in the *Project* dropdown at the top of the screen. |
| 84 | + |
| 85 | +.. Click *{ols-long} Operator*. |
| 86 | + |
| 87 | +.. Click *OLSConfig*, then click the `cluster` configuration instance in the list. |
| 88 | + |
| 89 | +.. Click the *YAML* tab. |
| 90 | + |
| 91 | +.. Insert the `spec.ols.rag` yaml code: |
| 92 | ++ |
| 93 | +.Example `OLSconfig` CR file |
| 94 | +[source,yaml,subs="attributes,verbatim"] |
| 95 | +---- |
| 96 | +apiVersion: ols.openshift.io/v1alpha1 |
| 97 | +kind: OLSConfig |
| 98 | +metadata: |
| 99 | + name: cluster |
| 100 | +spec: |
| 101 | + ols: |
| 102 | + rag: |
| 103 | + - image: quay.io/<username>/my-byok-image:latest # <1> |
| 104 | + indexPath: /rag/vector_db |
| 105 | + indexID: vector_db_index |
| 106 | +---- |
| 107 | +<1> Where `image` specifies the tag for the image that was pushed to the image registry so that the {ols-long} Operator can access the custom content. The {ols-long} Operator can work with more than one RAG database that you create. |
| 108 | + |
| 109 | +. Click *Save*. |
| 110 | + |
| 111 | +.Verification |
| 112 | + |
| 113 | +* Access the {ols-long} virtual assistant and submit a question associated with the custom content that you provided to the LLM. |
| 114 | ++ |
| 115 | +The {ols-long} virtual assistant generates a response based on the custom content. |
0 commit comments