## 5 Implementation and Results  
This article implements an LLM-based search framework designed to enhance inventory search and recommendation processes within a control panel manufacturing facility. The framework utilized a dataset provided by our industry sponsor, which includes part numbers, availability, and usage information. Developed as a Python version 3.11-based API, the system integrates seamlessly with internal engineering and production tools, providing flexible access to inventory data. As illustrated in Figure 6, the architecture is designed to support efficient searches across a large and dynamic inventory, thereby reducing dependence on tribal knowledge and minimizing inefficiencies associated with manual search refinement. The core pipeline for search and recommendation is detailed in Algorithm 1. When a user submits a query, it is first converted into a 384-dimensional vector embedding, using a transformer-based model. This embedding is then used to search a vector database for similar items, applying a similarity threshold of 0.7 and returning up to five candidate parts. These candidates are subsequently evaluated by the LLM, which generates a context-aware recommendation that is returned to the user. The specific parameters, including embedding dimension, similarity threshold, and maximum result count, were selected based on system testing to balance performance with the computational cost of LLM inference. \begin{table}
\begin{tabular}{l l} \hline \hline
**Category** & **Metric and Description** \\ \hline
**Generation** & **Faithfulness**: How factually accurate is the generated answer? \\  & **Answer Relevancy**: How relevant is the answer to the question? \\ \hline
**Retrieval** & **Context Precision**: The signal-to-noise ratio of the retrieved context. \\  & **Context Recall**: Can it retrieve all the relevant information required? \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of metrics. A distinguishing feature of the proposed framework is its use of a vector database that dynamically expands as new queries are processed. This capability enables continuous learning, allowing the system to generate increasingly accurate and context-aware search results over time. By serving as an intelligent assistant, the system provides engineers with rapid access to relevant component and design information, thereby streamlining workflows and supporting data-driven decision-making. ```
1:\(q\): user query
2:\(model\): embedding model (dimension \(d=384\))
3:\(db\): vector database (threshold 0.7)
4:\(N\): max results (\(N=5\))
5:procedureSimplesearchRandomRandomRandom(\(q\), \(model\), \(db\), \(N\))
6:\(v_{q}\gets model\_get\_embedding(q)\)
7:\(C\leftarrow\textbf{VectorDB\_search}(v_{q},db,N,0.7)\)
8:\(response\leftarrow\textbf{LLM\_recommend}(q,C)\)
9:returnresponse
10:endprocedure
```  
**Algorithm 1** Inventory Search and Recommendation Pipeline  
The framework utilized the _all-MiniLM-L6-v2_ transformer model for embedding generation [33]. To further enhance search and recommendation accuracy, the embedding model was optionally fine-tuned using domain-specific part lists and sample queries, as guided by the model provider [34]. A high-level overview of this training process is depicted in Figure 7.  
The trained embedding model transformed the complete parts database into a vector database. Each part and its associated characteristics were represented as a single embedding and stored in the vector database. We used Qdrant to store these vector embeddings, both as dense and sparse vectors, utilizing Qdrant's internal tools. The embedding model maps sentences and paragraphs into a 384-dimensional dense vector space suitable for clustering and semantic search [33]. Algorithm 2 describes the basic steps of converting parts into embeddings. Figure 6: High-level depiction of the implementation. The search process begins by taking a user query, converting it to a vector using the embedding model, and performing an initial vector search using Qdrant's search tools.