Back

Enfinite Meets AI - Chatbot Revolutionizes Information Access in Oil, Gas & Water Wells Operations

goML Team

June 21, 2024
Table of Content

Business Problem

  • In the dynamic and data-intensive domain of oil, gas, and water wells, efficiently accessing and interpreting vast amounts of information is crucial. The client required a sophisticated chatbot capable of answering user queries by retrieving information from both a PostgreSQL database and a collection of PDF documents. The challenge was to seamlessly classify and process these queries to deliver accurate and relevant information to the users.

About Enfinite

Enfinite Technologies is an artificial intelligence (AI) company that helps oil and gas (O&G) exploration and production (E&P) companies optimize production from their wells. Their AI platform uses real-time data to predict failures in critical equipment and autonomously optimize performance. This can help E&P companies increase production volumes and reduce downtime.

Solution

To address the challenge, we developed a sophisticated chatbot system with the following components:

Query Classification

Classifier Model: Used GPT-3.5-turbo for a few-shot classifier to determine if a query is database-related or pertains to domain-specific PDFs.

Database-Related Queries

Text-to-SQL Agent: Employed the Lyzr text-to-sql agent (enterprise version) with llama3-instruct model to convert natural language queries into SQL, retrieve data from the PostgreSQL database, and visualize results.

Domain-Related Queries

Chat Agent: Utilized the Lyzr open-source chat agent to handle queries related to PDF documents.
Vector Store: Stored and indexed the client’s PDFs, allowing efficient searches and accurate information retrieval.

API Endpoints

New Chat: Endpoint to initiate a new chat session.
Existing Chat: Endpoint to continue an existing chat, maintaining context for seamless user experience.

Response Structure

Modified Responses: Redesigned to ensure easy integration with the client’s UI, enhancing user interaction.

Click to View in Full Size

Architecture

  • User Query Handling: Users send queries via API Gateway, which forwards them to a Lambda function for initial processing.
  • Initial Processing: The Lambda function uses LyzrSDK and Docker from ECR, then sends the query to SageMaker Llama2 for prompt engineering and API classification.
  • Data Fetching: Classified APIs and parameters are processed by a second Lambda function to fetch necessary data from the client database.
  • Final Processing: The fetched data and query are further processed by a second instance of SageMaker Llama2 for final prompt engineering, returning the response through the Lambda function and API Gateway to the user.
  • System Management: Infrastructure management and monitoring are handled by CloudTrail, CloudFormation, IAM, and CloudWatch for logs and alarms, ensuring secure and efficient operations.

Outcomes

Routing
Increased response accuracy and efficiency
Retrieval
Quickly obtain data and visualizations for enhanced productivity
Access
Use of vector store enabled detailed extraction from domain-specific PDFs