DEV Community

Evan Lin
Evan Lin

Posted on • Originally published at evanlin.com on

[GAI Conference] Enterprise Prompt Engineering by E.SUN Bank - Notes

title: [GAI Conference] Enterprise Prompt Engineering by E.SUN Bank - Notes
published: false
date: 2023-09-10 00:00:00 UTC
tags: 
canonical_url: http://www.evanlin.com/til-ent-prompt-eng-note/
---

<iframe width="560" height="315" src="https://www.youtube.com/embed/R3oTpyoPh70?si=cMVtbSHPrFzwqOQB" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen=""></iframe>
# Summary:

This article mainly focuses on the sharing from E.SUN Bank at the GAI conference, recording some key points.  It also includes observations from other users and myself regarding potential applications with LangChain.

## Main Problem:

How E.SUN Bank uses Prompt Engineering to create a bank customer service assistant. A similar problem arises when using the questions themselves for Embedding; because the questions are not well-formed, it's difficult to find better vector-similar answers through Embedding.

![image-20230912101335592](http://www.evanlin.com/images/2022/image-20230912101335592.png)

## Solution:

![image-20230912101349591](http://www.evanlin.com/images/2022/image-20230912101349591.png)

HyDE (Hybrid Diagnostic Engine) Explanation:

Enter fullscreen mode Exit fullscreen mode

Origin
In many cases, we need to understand and explain the behavior of AI models. This is especially important for large language models, as their behavior can affect important decision-making processes. However, understanding their behavior is not easy due to the complexity of these models. This is the origin of HyDE in LLMs.

Explanation
HyDE is a hybrid diagnostic engine that combines model-based diagnostics and data-based diagnostics. Model-based diagnostics relies on a theoretical understanding of the system, while data-based diagnostics relies on learning from actual operational data.

In LLMs, HyDE can be used to explain the behavior of the model. For example, it can help us understand why the model produces a specific output or why it performs better in some situations than others. This understanding can help us improve the model and make it more suitable for specific tasks.

The main advantage of HyDE is that it can handle large amounts of data and complex models. In addition, it can handle uncertainty, which is very important in many practical situations.

In summary, HyDE provides a powerful tool in LLMs that can help us understand and explain the behavior of the model.


### How to implement HyDE through LangChain

[https://python.langchain.com/docs/use\_cases/question\_answering/how\_to/hyde](https://python.langchain.com/docs/use_cases/question_answering/how_to/hyde)

![image-20230912101948714](http://www.evanlin.com/images/2022/image-20230912101948714.png)

In simple terms, by declaring `embedding` is generated through HyDE. This way, when searching through embedding, it can automatically generate more meaningful (possibly) questions.

### Further Research

LangChain's MultiVector Retriever implements this part and can use LLMs to generate Hypothetical questions and build embeddings.

[https://python.langchain.com/docs/modules/data\_connection/retrievers/multi\_vector](https://python.langchain.com/docs/modules/data_connection/retrievers/multi_vector)

Does HyDE alone provide a good bank customer ChatBot? In fact, the final architecture is

### Completed Architecture

![image-20230912102404963](http://www.evanlin.com/images/2022/image-20230912102404963.png)

How to achieve good responses?

### More Advanced Methods: (Suitable for the Banking Industry)

![image-20230912102130805](http://www.evanlin.com/images/2022/image-20230912102130805.png)

-   Achieve rapid classification through classification numbers and provide relevant response templates (as shown below)

![image-20230912102145856](http://www.evanlin.com/images/2022/image-20230912102145856.png)

#### Advantages and Disadvantages:

-   Advantages:
    -   Avoid Prompt Injection
    -   Fast response (4 chars)
-   Disadvantages:
    -   Rigid (suitable for the banking industry)
    -   Prompts will repeatedly take up space.

## Related Prompt Applications

![image-20230912102545451](http://www.evanlin.com/images/2022/image-20230912102545451.png)

![image-20230912102554608](http://www.evanlin.com/images/2022/image-20230912102554608.png)

DD

![image-20230912102630043](http://www.evanlin.com/images/2022/image-20230912102630043.png)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)