AI is no longer just a buzzword, it’s an integral part of our daily routines, offering innovative solutions and assisting us in making both simple and complex decisions. The potential of AI is vast and almost limitless, making it essential to leverage its capabilities wherever possible.
SnapLogic has recently introduced the “OPEN AI LLM” Snappack, a tool designed to help businesses build modern, future-proof integrations and solutions. This Snappack opens up new possibilities for interacting with today’s advanced AI assistants, making it easier than ever to incorporate AI into your operations.
In this blogpost, we’ll explore a practical use case for the OPEN AI LLM Snappack: enhancing price negotiations between buyers and suppliers by gathering crucial sales information—without the need for heavy, costly reports.
The Challenge: Complex Price Negotiations
Imagine a global company with hundreds of stores, suppliers, and thousands of different products being sold across various regions daily. When it comes time for price negotiations, both buyers and suppliers have their own objectives: suppliers aim to sell at higher prices, while buyers strive to purchase at lower costs.
To navigate these negotiations effectively, both parties need a comprehensive analysis of each item’s pricing in specific markets and stores. This ensures that negotiations are based on accurate data, preventing the risk of overpaying or underselling.
The Solution: AI-Driven Sales Data Integration with SnapLogic
To address this challenge, we propose developing an AI-driven system that collects sales data from every store within the company, processes it through SnapLogic, and quickly delivers the needed information based on user queries. This approach eliminates the need for standard manual analysis of sales reports, saving time and effort while providing precise data for informed decision-making.
How It Works: Building the AI-Powered Negotiation Tool
This use case leverages SnapLogic’s GenAI Builder Snaps to create a Sales Report Q&A pipeline, integrated with a chatbot that answers questions from end users. The solution involves two key pipelines:
- Data Fetching from Sales Reports: This pipeline loads data from sales reports (source files) from each store. It processes the data by breaking it into chunks, performing vectorization for each chunk, and storing the results in the Pinecone vector database.
- Answer Generation Based on User Queries: Connected to an AI chatbot, this pipeline takes user questions, generates embeddings, queries similar embeddings in Pinecone, constructs the necessary context, and generates accurate responses.
Pipeline for data fetching from sales reports
- The File Reader Snap is used to fetch source data, and it can be replaced with a pipeline that continuously reads source files. The input detection pipeline’s purpose is to poll all sales reports stored in a specific shared location.
- To chunk the data, the Chunk snap is used to split the data into separate blocks.
- The source data is vectorized with the OpenAI Embedder snap.
- The Mapper is used to prepare the data to be eligible for insert/update in the Pinecone vector database.
Here is an example of a sales report, source data that is inserted into the Pinecone database:
Pipeline for Providing answers based on user questions
Step-by-Step Breakdown of the AI-Driven Pipeline for Supplier Negotiations
- JSON Generator: Initially used to create questions in a human-readable format, the JSON Generator snap serves as a helpful tool during development. However, in a real-world environment, this snap becomes unnecessary. Instead, the pipeline can be deployed as a trigger task (API), where end-users submit questions directly through a custom software application that interacts with this pipeline.
- OpenAI Embedder Snap: This snap is responsible for embedding the questions into vector format, using the same model that was previously used to embed the source data. This ensures consistency in how the data and queries are processed.
- Map Snap: The Map snap plays a crucial role in formatting the data appropriately for querying within the Pinecone database. It ensures that the data is in the correct structure for efficient retrieval.
- Pinecone Query Snap: This snap is used to query the Pinecone database based on the user’s questions. It searches for relevant data that matches the embedded query, providing the necessary context for further processing.
- Data Transformation Mapper: After querying the data, this mapper is used to perform any necessary transformations, ensuring that the data is in the required format for the next steps.
- OpenAI Prompt Generator Snap: The OpenAI Prompt Generator snap prepares the data into the correct prompt format, setting the stage for generating accurate and contextually relevant responses.
- OpenAI Chat Completions: This snap makes the magic. It generates chat completions using the specified AI model and parameters, delivering the final response based on the user’s query.
- JSON Splitter Snap: To simplify the data structure, the JSON Splitter snap is used, breaking down complex data into more manageable components for easier handling.
- Final Output Mapper: The final mapper in the pipeline is responsible for preparing the output data. It ensures that the response is in the correct format before it is delivered back to the end-user, providing seamless and efficient interaction.
Use cases
End users can ask various simple or complex questions related to sales reports that are already uploaded into the Pinecone vector database. Here are several interesting questions for the given dataset.
- Question: What is the single price and supplier of item 1001, sold in POS_ID 9003, on 2024-07-20?
- Response: The single price of item 10001 sold in POS_ID 90003 on 2024-07-20 is 510 and the supplier is 50001.
Based on the source data, the answer is correct
- Question: Summarize the Total amount in all POS with ID: 90002.
- Response: The total amount in all POS with ID: 90002 is 1127.
Based on the source data, the answer is correct
- Question: What is the single price and supplier of item 1001, sold in POS_ID 9003, on 2024-07-20?
- Response: The single price of item 10001 sold in POS_ID 90003 on 2024-07-20 is 510 and the supplier is 50001.
Based on the source data, the answer is correct
- Question: What is the total amount for item group 3?
- Response: The total amount for item group 3 (Windows 11 Pro version) is 112 + 115 + 110 + 110 + 400 = 847.
Based on the source data, the answer is correct
- Question: What is the single price of item 10004 in POS ID 9004? What will be the amount of this item if single price has 10 % discount and sell quantity is 46 pcs?
- Response: The single price of item 10004 in POS id 9004 is 1. If the single price has a 10% discount, the new price would be 0.9. If the sell quantity is 46 pcs, the total amount for this item would be 41.4.
Based on the source data, the answer is correct
Conclusion
This use case demonstrates the powerful potential of leveraging SnapLogic’s features, particularly the OPEN AI LLM Snappack, to develop a sophisticated chatbot that enhances supplier negotiations. By integrating advanced AI capabilities into your workflow, you can automate complex tasks, streamline data processing, and generate valuable insights with ease.
The implementation and maintenance of this solution are straightforward, thanks to SnapLogic’s intuitive platform. With minimal effort, businesses can deploy this AI-driven system to handle a wide range of tasks, from querying sales data to delivering precise and contextually relevant responses.
Moreover, this approach isn’t limited to supplier negotiations alone. The flexibility and scalability of SnapLogic’s AI integration open the door to numerous other applications across various industries. Whether it’s optimizing internal processes, enhancing customer interactions, or driving data-driven decision-making, this solution can have a big impact on company’s efficiency and effectiveness. In summary, by embracing SnapLogic’s AI tools, businesses can not only improve their negotiation strategies but also unlock new opportunities for innovation and growth across their operations.