In today’s digital landscape, chatbots are evolving to become more intelligent, responsive, and capable of handling complex interactions. In this blog post, we delve into the creation of a next-generation chatbot by harnessing the power of Oracle Cloud Infrastructure (OCI) Data Science capabilities like AI Quick Actions and model deployment, as well as Mistral-7B-Instruct-v0.2, Oracle Database 23ai, LangChain, and Oracle Digital Assistant (ODA). Each of these technologies brings unique strengths, enabling us to build a chatbot that not only processes and responds to user queries with remarkable accuracy, but also offers a seamless and engaging conversational experience.

One of the standout features of Oracle Database 23ai is its advanced vector search capabilities. This technology allows for efficient retrieval of information by converting text into high-dimensional vectors, which are then compared for relevance. When integrated into the RAG pipeline, Oracle Database 23ai’s vector search enhances the chatbot’s ability to access and deliver the most pertinent information from vast datasets. This enhancement ensures that the responses generated are contextually accurate and highly relevant to the user’s query.

ODA further elevates the chatbot’s functionality by providing a robust platform for building, deploying, and managing conversational AI solutions. It offers prebuilt connectors, natural language understanding (NLU), and dialogue management, which streamline the development process and ensure a smooth user experience. The combination of ODA and the RAG pipeline enables the chatbot to handle complex interactions and maintain a natural flow of conversation, improving user engagement and satisfaction.

By employing the synergy of Oracle Database 23ai and ODA within the RAG pipeline, developers can create a chatbot that excels in both retrieval accuracy and conversational fluidity. This integrated approach not only reduces the time and effort required to build sophisticated chatbots, but also results in a solution that’s scalable, efficient, and capable of delivering superior user experiences. Whether you’re a developer, a tech enthusiast, or a business leader looking to enhance customer engagement, this guide can equip you with the knowledge and tools to build an advanced chatbot that stands out in the crowded digital arena.

Use cases

This integration of services and features can prove useful in the following use cases:

  • Personalized customer support: Querying both guidebooks and customer history can create a better view of the customer’s issues and help diagnose and solve the problem faster.
  • Supply chain optimization: Querying vendor data with internal business ordering and shipping data can result in better decision-making and faster responses to changes in the supply chain.
  • Optimize sales: Query customer relationship management (CRM) data to identify high-potential leads and suggest strategies to increase deal closing probability.

Benefits of Oracle AI Vector Search

Oracle Database is a leading repository of operational and enterprise data. Enterprise applications usually need to search a combination of business data and unstructured data. For example, a retail website could feature searches based on a natural language product description and a target product image, along with other filters, such as price, store location, manufacturer, and current availability. This search requires simultaneously searching unstructured catalog data (product description and image), structured catalog data (price, store location and manufacturer) as well as real time transactional data (such as current inventory).

Solution overview

Architecture diagram for the solution
Architecture Diagram for the solution

This diagram illustrates the architecture and workflow of building an advanced chatbot using Mistral-7B-Instruct-v0.2, Oracle Database 23ai, RAG, LangChain, and ODA. Based on the diagram, the workflow moves through the following detailed steps:

  1. User interaction: The user sends a request to the chatbot through the Oracle Digital Assistant interface.
  2. Request handling: The digital assistant receives the request and forwards it to the OCI Data Science infrastructure.
  3. Query processing: Within OCI Data Science, the request is routed to LangChain, which acts as the orchestrator for managing the interaction between various model deployments. LangChain then processes the request and identifies the need for information retrieval from external documents and enterprise data.
  4. Vectorization: The request is sent to an embedding model deployment, which transforms the query into a high-dimensional vector representation. This vectorized query is then sent to Oracle Database 23ai for vector search.
  5. Data Retrieval: Oracle Database 23ai performs a similarity search on unstructured data in form of documents in PDF and HTML format and combines that search with regular search on other business data in the database. Relevant documents or chunks are retrieved and will be sent to next step for further processing.
  6. Querying the external models: The retrieved information generates a query for the Mistral-7B-Instruct-v0.2 model deployment provisioned using AI Quick Actions features in OCI Data Science. The Mistral-7B-Instruct-v0.2 model processes the query and generates a response based on its training and the retrieved context.
  7. Reranking: You can further refine the generated response with a rerank model deployment. The rerank model evaluates and ranks the responses to help ensure that the most relevant and accurate response is selected.
  8. Response generation: The refined response is sent back to LangChain, which consolidates the final output.
  9. Returning the response to the user: The final response is returned to the digital assistant. The digital assistant then delivers the response to the user.

Learn more about the detailed solution

For detailed steps showcasing how to implement this, visit our tutorial into the Learn Page

For detailed implementation code walk-through, see the AI samples GitHub repository.

For more information, see the following resources:

References

Try Oracle Cloud Free Trial! A 30-day trial with US$300 in free credits gives you access to Oracle Cloud Infrastructure Data Science service. For more information, see the following resources:

Full sample including all files in OCI Data Science sample repository on Github.

Visit our datascience service documentation.

Configure your OCI tenancy with these setup instructions and start using OCI Data Science.

Star and clone our new GitHub repo! We included notebook tutorials and code samples.

Watch our tutorials on our YouTube playlist

Try one of our LiveLabs. Search for “data science.”