Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions internal/controller/ols_app_server_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,19 @@ func (r *OLSConfigReconciler) generateOLSConfigMap(ctx context.Context, cr *olsv
referenceIndex := ReferenceIndex{
ProductDocsIndexPath: filepath.Join(RAGVolumeMountPath, fmt.Sprintf("rag-%d", i)),
ProductDocsIndexId: index.IndexID,
ProductDocsOrigin: index.Image,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syedriko What will be the indexOrigin name for BYOK images ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a BYOK image, its ProductDocsOrigin will be its image:tag. For example,

ols:
    rag:
    - image: quay.io/openshift-lightspeed-test/assisted-installer-guide:2025-1

will log

[ols.src.rag_index.index_loader:index_loader.py:148] INFO: Loading vector index #0 from quay.io/openshift-lightspeed-test/assisted-installer-guide:2025-1...
...
[ols.src.rag_index.index_loader:index_loader.py:148] INFO: Loading vector index #1 from Red Hat OpenShift 4.19 documentation...

}
referenceIndexes = append(referenceIndexes, referenceIndex)
}
// OCP documentation is always available
ocpReferenceIndex := ReferenceIndex{
ProductDocsIndexPath: "/app-root/vector_db/ocp_product_docs/" + r.Options.OpenShiftMajor + "." + r.Options.OpenshiftMinor,
ProductDocsIndexId: "ocp-product-docs-" + r.Options.OpenShiftMajor + "_" + r.Options.OpenshiftMinor,
if !cr.Spec.OLSConfig.ByokRAGOnly {
ocpReferenceIndex := ReferenceIndex{
ProductDocsIndexPath: "/app-root/vector_db/ocp_product_docs/" + r.Options.OpenShiftMajor + "." + r.Options.OpenshiftMinor,
ProductDocsIndexId: "ocp-product-docs-" + r.Options.OpenShiftMajor + "_" + r.Options.OpenshiftMinor,
ProductDocsOrigin: "Red Hat OpenShift " + r.Options.OpenShiftMajor + "." + r.Options.OpenshiftMinor + " documentation",
}
referenceIndexes = append(referenceIndexes, ocpReferenceIndex)
}

referenceIndexes = append(referenceIndexes, ocpReferenceIndex)

olsConfig := OLSConfig{
DefaultModel: cr.Spec.OLSConfig.DefaultModel,
DefaultProvider: cr.Spec.OLSConfig.DefaultProvider,
Expand Down
10 changes: 8 additions & 2 deletions internal/controller/ols_app_server_assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ var _ = Describe("App server assets", func() {
{
ProductDocsIndexId: "ocp-product-docs-" + major + "_" + minor,
ProductDocsIndexPath: "/app-root/vector_db/ocp_product_docs/" + major + "." + minor,
ProductDocsOrigin: "Red Hat OpenShift 123.456 documentation",
},
},
},
Expand Down Expand Up @@ -838,17 +839,20 @@ var _ = Describe("App server assets", func() {
ocpIndex := ReferenceIndex{
ProductDocsIndexId: "ocp-product-docs-" + major + "_" + minor,
ProductDocsIndexPath: "/app-root/vector_db/ocp_product_docs/" + major + "." + minor,
ProductDocsOrigin: "Red Hat OpenShift 123.456 documentation",
}

// OLS-1823: prioritize BYOK content over OCP docs
Expect(olsconfigGenerated.OLSConfig.ReferenceContent.Indexes).To(Equal([]ReferenceIndex{
ReferenceIndex{
{
ProductDocsIndexId: "ocp-product-docs-4_19",
ProductDocsIndexPath: RAGVolumeMountPath + "/rag-0",
ProductDocsOrigin: "rag-ocp-product-docs:4.19",
},
ReferenceIndex{
{
ProductDocsIndexId: "ansible-docs-2_18",
ProductDocsIndexPath: RAGVolumeMountPath + "/rag-1",
ProductDocsOrigin: "rag-ansible-docs:2.18",
},
ocpIndex,
}))
Expand Down Expand Up @@ -1068,6 +1072,7 @@ ols_config:
indexes:
- product_docs_index_id: ocp-product-docs-` + major + `_` + minor + `
product_docs_index_path: /app-root/vector_db/ocp_product_docs/` + major + `.` + minor + `
product_docs_origin: Red Hat OpenShift 123.456 documentation
tls_config:
tls_certificate_path: /etc/certs/lightspeed-tls/tls.crt
tls_key_path: /etc/certs/lightspeed-tls/tls.key
Expand Down Expand Up @@ -1127,6 +1132,7 @@ ols_config:
indexes:
- product_docs_index_id: ocp-product-docs-` + major + `_` + minor + `
product_docs_index_path: /app-root/vector_db/ocp_product_docs/` + major + `.` + minor + `
product_docs_origin: Red Hat OpenShift 123.456 documentation
tls_config:
tls_certificate_path: /etc/certs/lightspeed-tls/tls.crt
tls_key_path: /etc/certs/lightspeed-tls/tls.key
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ type ReferenceIndex struct {
ProductDocsIndexPath string `json:"product_docs_index_path,omitempty"`
// Name of the index to load.
ProductDocsIndexId string `json:"product_docs_index_id,omitempty"`
// Where the database was copied from, i.e. BYOK image name.
ProductDocsOrigin string `json:"product_docs_origin,omitempty"`
}

type ReferenceContent struct {
Expand Down