Skip to content

Commit 6fd6909

Browse files
jwilliams-mongooliviacaulfieldcandur
authored
Port solutions prs 1 (#13567)
* DOCSP-51698-llm-rag-claim-management (#282) * DOCSP-51698-llm-rag-claim-management * DOCSP-51698 data architecture * DOCSP-51698 data model approach * DOCSP-51698 up to key learnings * DOCSP-51698 key learnings * DOCSP-51698 review updates * DOCSP-51698 internal review 2 updates * DOCSP-51698 TOC update * DOCSP-51698 external review updates 2 * DOCSP-51698 double intro fix * DOCSP-51698 proprietary update * DOCSP-51698 final edits * Update Media Personalization - Add key Learnings (#285) * updated solution library * changed solution overview * changed personalization media overview * updated reference architecture section * updated reference architecture section * added learn more * updated learn more * updated key learning * updated key learnings * updated depth level to one * updated images * updated reference architecture * updated resolution * updated image resolution * updated image resolution * implemented suggestions * changed you can reuse at the end * updated solution * updated solution * updated solution * updated solution * updated solution library --------- Co-authored-by: oliviacaulfield <[email protected]> Co-authored-by: Diego Canales <[email protected]>
1 parent 36b323d commit 6fd6909

File tree

8 files changed

+285
-268
lines changed

8 files changed

+285
-268
lines changed

content/atlas-architecture/current/source/includes/images/industry-solutions/demo-model.svg

Lines changed: 0 additions & 11 deletions
This file was deleted.

content/atlas-architecture/current/source/includes/images/industry-solutions/document-model-media.svg

Lines changed: 1 addition & 0 deletions
Loading

content/atlas-architecture/current/source/includes/images/industry-solutions/ist-homepage.svg

Lines changed: 0 additions & 11 deletions
This file was deleted.

content/atlas-architecture/current/source/includes/images/industry-solutions/ist-media-interface.svg

Lines changed: 1 addition & 0 deletions
Loading

content/atlas-architecture/current/source/includes/images/industry-solutions/media-personalization-architecture.svg

Lines changed: 1 addition & 0 deletions
Loading

content/atlas-architecture/current/source/solutions-library/claim-management.txt

Lines changed: 149 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _arch-center-is-claim-management:
22

3-
=====================================================
4-
Claim Management Using LLMs and Vector Search for RAG
5-
=====================================================
3+
======================================================
4+
Claims Management Using LLMs and Vector Search for RAG
5+
======================================================
66

77
.. facet::
88
:name: genre
@@ -18,8 +18,8 @@ Claim Management Using LLMs and Vector Search for RAG
1818
:depth: 1
1919
:class: singlecol
2020

21-
Discover how to combine Atlas Vector Search and large language models (LLMs) to
22-
streamline the claim adjustment process.
21+
Discover how to combine MongoDB Atlas Vector Search and Large Language Models
22+
(LLMs) to streamline the claims adjustment process.
2323

2424
**Use cases:** `Gen AI <https://www.mongodb.com/use-cases/artificial-intelligence>`__,
2525
`Content Management <https://www.mongodb.com/solutions/use-cases/content-management>`__
@@ -38,45 +38,44 @@ streamline the claim adjustment process.
3838
Solution Overview
3939
-----------------
4040

41-
One of the biggest challenges for claim adjusters is pulling and aggregating
42-
information from disparate systems and diverse data formats. PDFs of policy
43-
guidelines might be stored in a content-sharing platform, customer information
44-
locked in a legacy CRM, and claim-related pictures and voice reports in yet
45-
another tool. All of this data is not just fragmented across siloed sources and
46-
hard to find but also in formats that have been historically nearly impossible
47-
to index with traditional methods. Over the years, insurance companies have been
48-
accumulating terabytes of `unstructured data <https://www.mongodb.com/unstructured-data>`__
49-
in their datastores, but failing to capitalize on the possibility of accessing
50-
and leveraging it to uncover business insights, deliver better customer
51-
experiences, and streamline operations. Some of our customers even admit they’re
52-
not fully aware of all of the data that’s truly in their archives. There’s a
53-
tremendous opportunity now to leverage all of this unstructured data to the
54-
benefit of these organizations and their customers.
55-
56-
Our solution addresses these challenges by combining the power of
57-
`Altas Vector Search <https://www.mongodb.com/products/platform/atlas-vector-search>`__
58-
and a `Large Language Model (LLM) <https://www.mongodb.com/basics/large-language-models>`__ to
59-
in a `retrieval augmented generation (RAG) <https://www.mongodb.com/basics/retrieval-augmented-generation>`__
60-
system, allowing organizations to go beyond the limitations of baseline
61-
foundational models, making them context-aware by feeding them proprietary data.
62-
In this way, they can leverage the full potential of AI to streamline operations.
63-
64-
Reference Architectures
65-
-----------------------
66-
67-
With MongoDB
68-
~~~~~~~~~~~~
69-
70-
MongoDB Atlas combines transactional and search capabilities in the same
71-
platform, providing a unified development experience. As embeddings are stored
72-
alongside existing data, when running a vector search query, we get the document
73-
containing both the vector embeddings and the associated metadata, eliminating
74-
the need to retrieve the data elsewhere. This is a great advantage for
75-
developers who don’t need to learn to use and maintain a separate technology and
76-
can fully focus on building their apps.
77-
78-
Ultimately, the data obtained from MongoDB Vector Search is fed to the LLM as
79-
context.
41+
One of the biggest challenges for claims adjusters is aggregating information
42+
from diverse systems and data formats. Over the years, insurance
43+
companies have accumulated terabytes of `unstructured data
44+
<https://www.mongodb.com/unstructured-data>`__ in their datastores, which can
45+
help uncover business insights, deliver better customer experiences, and
46+
streamline operations. However, many companies fail to capitalize on this.
47+
48+
To help your organization overcome these challenges, you can build a claims
49+
management solution with MongoDB that combines `Atlas Vector Search
50+
<https://www.mongodb.com/products/platform/atlas-vector-search>`__ and `LLMs
51+
<https://www.mongodb.com/basics/large-language-models>`__ in a `retrieval
52+
augmented generation (RAG)
53+
<https://www.mongodb.com/basics/retrieval-augmented-generation>`__ system. This
54+
framework helps organizations go beyond the limitations of basic foundational
55+
models and use their proprietary data to make models context-aware, streamlining
56+
operations with AI’s full potential.
57+
58+
Reference Architecture
59+
----------------------
60+
61+
MongoDB provides a unified development experience by storing documents alongside
62+
their vector embeddings and associated metadata, eliminating the need to
63+
retrieve data elsewhere. This allows users to focus on building their
64+
application instead of maintaining a separate technology. Ultimately, the data
65+
obtained from MongoDB Vector Search is fed to the LLM as context.
66+
67+
The process of the RAG querying flow is as follows:
68+
69+
#. The user writes a prompt in natural language.
70+
71+
#. Voyage AI's embedding model vectorizes the prompt.
72+
73+
#. Atlas Vector Search uses the vectorized prompt to retrieve relevant
74+
documents.
75+
76+
#. LLM uses both the context and original question to generate an answer.
77+
78+
#. The user receives an answer.
8079

8180
.. figure:: /includes/images/industry-solutions/rag-querying-flow.svg
8281
:figwidth: 1200px
@@ -87,96 +86,136 @@ context.
8786
Data Model Approach
8887
-------------------
8988

90-
The “claim” collection contains documents including a number of fields
91-
related to the claim. In particular, we are interested in the
92-
``claimDescription`` field, which we vectorize and add to the document
93-
as ``claimDescriptionEmbedding``. This embedding is then indexed and
94-
used to retrieve documents associated with the user prompt.
89+
In the demo solution, the data model is a simplified design that emulates
90+
real-world insurance claim data. The approach leverages MongoDB's flexible
91+
document model to handle the diverse data structure that stores embeddings
92+
alongside their related document.
9593

96-
.. code-block:: json
97-
:emphasize-lines: 4, 10
98-
:copyable: true
94+
The ``claims_final`` collection stores claim information. The relevant fields
95+
are the ``claimDescription`` field and its corresponding embedding
96+
``claimDescriptionEmbedding``. This embedding is indexed and used to retrieve
97+
documents associated with the user prompt. The documents in this collection are
98+
as follows:
9999

100+
.. code-block:: javascript
101+
100102
{
101-
_id: ObjectId('64d39175e65'),
102-
customerID: "c113",
103-
claimDescription: "A motorist driving...",
104-
damageDescription: "Front-ends of both...",
105-
lossAmount: 1250,
106-
photo: "image_65.jpg"
107-
claimClosedDate: "2024-02-03",
108-
coverages: Array(2),
109-
claimDescriptionEmbedding: [0.3, 0.6, ..., 11.2]
103+
"_id": {
104+
"$oid": "65cc809c76da22d0089dfb2e"
105+
},
106+
"customerID": "c105",
107+
"policyNumber": "p105",
108+
"claimID": "cl105",
109+
"claimStatusCode": "Subrogation",
110+
"claimDescription": "High winds caused ...",
111+
"totalLossAmount": 4200,
112+
"claimFNOLDate": "2023-10-27",
113+
"claimClosedDate": "2024-09-01",
114+
"claimLineCode": "Auto",
115+
"damageDescription": "Roof caved in ...",
116+
"insurableObject": {
117+
"insurableObjectId": "abc105",
118+
"vehicleMake": "Make105",
119+
"vehicleModel": "Model105"
120+
},
121+
"coverages": [
122+
{
123+
"coverageCode": "888",
124+
"description": "3rd party responsible"
125+
},
126+
{
127+
"coverageCode": "777",
128+
"description": "Vehicle rental/loaner service for customer"
129+
}
130+
],
131+
"claimDescriptionEmbedding": [-0.017, ..., 0.011],
132+
"damageDescriptionEmbedding": [-0.047, ..., -0.043],
133+
"photo": "105.jpg",
134+
"photoEmbedding": [9.629, ..., 14.075]
110135
}
111136

112-
Building the Solution
113-
---------------------
137+
Build the Solution
138+
------------------
114139

115-
The instructions to build the demo are included in the README of `this
116-
Github repo <https://github.com/mongodb-industry-solutions/RAG-Insurance>`__.
117-
You’ll be guided through the following steps:
140+
For detailed setup instructions, follow the ``README`` of `this
141+
GitHub repository <https://github.com/mongodb-industry-solutions/RAG-Insurance>`__.
142+
The instructions guide you through the following steps:
118143

119-
- AWS Account with Bedrock access
120-
- Atlas connection setup
121-
- Dataset download
122-
- LLM configuration options
123-
- Vector Search index creation
144+
.. procedure::
145+
:style: normal
124146

125-
Visit the `Atlas Vector Search Quick Start guide
126-
<https://www.mongodb.com/docs/atlas/atlas-vector-search/tutorials/vector-search-quick-start/?tck=ai_as_web>`__
127-
to try our semantic search tool now.
147+
.. step:: Set up MongoDB database and collections
128148

129-
This `document
130-
<https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/#create-an-atlas-vector-search-index>`__
131-
walks you through the creation and configuration of the Vector Search
132-
index. Make sure you follow this structure:
149+
Create a new database in MongoDB Atlas called ``demo_rag_insurance`` and
150+
use the provided dataset ``demo_rag_insurance_claims.json`` to create a
151+
collection called ``claims_final``.
133152

134-
.. code-block:: json
135-
:copyable: true
153+
.. step:: Create a Vector Search Index
136154

137-
{
138-
"fields": [
139-
{
140-
"type": "vector",
141-
"path": "claimDescriptionEmbedding",
142-
"numDimensions": 350,
143-
"similarity": "cosine"
155+
Create and configure an :ref:`Atlas Vector Search index
156+
<atlas-ui-create-vector-search>` for ``claimDescriptionEmbeddingCohere``
157+
called ``vector_index_claim_description_cohere``. You must structure the
158+
search index as follows:
159+
160+
.. code-block:: json
161+
:copyable: true
162+
163+
{
164+
"fields": [
165+
{
166+
"type": "vector",
167+
"path": "claimDescriptionEmbeddingCohere",
168+
"numDimensions": 350,
169+
"similarity": "cosine"
170+
}
171+
]
144172
}
145-
]
146-
}
147173

148-
Ultimately, you have to run both the front and the back end. You’ll
149-
access a web UI that allows you to ask questions to the LLM, obtain an
150-
answer, and see the reference documents used as context.
174+
.. step:: Configure the Backend
175+
176+
Set up a virtual environment using Poetry.
177+
178+
.. step:: Interact with the API
179+
180+
Start the backend server.
181+
182+
.. step:: Connect to the Frontend
183+
184+
Configure environment variables and run the frontend.
185+
186+
You have to run both the front and back end. You’ll access a web UI
187+
that allows you to ask questions to the LLM, obtain an answer, and see the
188+
reference documents used as context.
189+
190+
To try MongoDB's semantic search tool now, visit the :ref:`Atlas Vector Search
191+
Quick Start guide <vector-search-quick-start>`.
151192

152193
Key Learnings
153194
-------------
154195

155-
- **Text embedding creation:** The embedding generation process can be
156-
carried out using different models and deployment options. It is
157-
important to consider privacy and data protection requirements. You
158-
can deploy a model locally if your data needs to remain on the
159-
servers. Otherwise, you can call an API and get your vector embeddings
160-
back, as explained in `this
196+
- **Generate Text Embeddings:** You can create embeddings using different models
197+
and deployment options. It is important to consider privacy and data
198+
protection requirements. You can deploy a model locally if your data needs to
199+
remain on the servers. Otherwise you can call an API and get your vector
200+
embeddings back, as explained in `this
161201
<https://www.mongodb.com/docs/atlas/atlas-vector-search/create-embeddings/>`__
162-
tutorial. You can use `Voyage AI (acquired by MongoDB)
202+
tutorial. You can use `Voyage AI
163203
<https://www.mongodb.com/blog/post/redefining-database-ai-why-mongodb-acquired-voyage-ai>`__
164204
or open-source models.
165205

166-
- **Creation of a Vector Search index in Atlas:** It is now possible to
167-
create indexes for `local deployments
168-
<https://www.mongodb.com/docs/atlas/cli/stable/atlas-cli-deploy-local/#std-label-atlas-cli-deploy-local-avs>`__.
206+
- **Create Vector Search Indexes:** You can build Vector Search indexes in
207+
MongoDB Atlas. Alternatively, you can also build indexes for :ref:`local
208+
deployments <atlas-cli-deploy-local>`.
169209

170-
- **Performing a Vector Search query:** Notably, `Vector Search queries <https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/>`__
171-
have a dedicated operator within MongoDB’s `aggregation pipeline
172-
<https://www.mongodb.com/docs/manual/aggregation/>`__. This means they
173-
can be concatenated with other operations, making it extremely
174-
convenient for developers because they don’t need to learn a different
210+
- **Perform a Vector Search Query:** You can run :ref:`Vector Search queries
211+
<return-vector-search-results>` with MongoDB's :ref:`aggregation pipeline
212+
<aggregation>`, allowing you to concatenate multiple operations in your
213+
workflow. This approach eliminates the need to learn another programming
175214
language or change context.
176215

177-
- Using LangChain as the framework that glues together MongoDB Atlas
178-
Vector Search and the LLM, allowing for an easy and fast RAG
179-
implementation.
216+
- **Develop a Fast RAG Implementation:** You can develop a fast RAG
217+
implementation with a :ref:`LangChain <langchain>` framework that combines
218+
MongoDB Atlas Vector Search and LLMs.
180219

181220
Authors
182221
-------

content/atlas-architecture/current/source/solutions-library/insurance-gen-ai.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Insurance Gen-AI
77

88
AI-Enhanced Claim Adjustment <solutions-library/insurance-image-search>
99
Build a PDF Search Application </solutions-library/pdf-search>
10-
Claim Management for RAG <solutions-library/claim-management>
10+
Claims Management for RAG <solutions-library/claim-management>

0 commit comments

Comments
 (0)