课程: Advanced LLMs with Retrieval Augmented Generation (RAG): Practical Projects for AI Applications

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Hands-on lab: Reverse HyDE

【“美翻了,我的村”作品展】江苏徐州马庄村:文化致富聚民心

课程: Advanced LLMs with Retrieval Augmented Generation (RAG): Practical Projects for AI Applications

Hands-on lab: Reverse HyDE

百度 今年2月,家人带着乐乐来到了合肥市第四人民医院进行检查。

- So let's see a simple implementation of the reverse HyDE technique. We will use this notebook with the usual improvement using the rich library and the warning suppression, and we'll start with the implementation of the ReverseHyde class. We'll use OpenAI, a text embedding model, the one that we saw in one of our previous notebooks. The get_embedding logic. It's quite simple. So we called the OpenAI client asking for embedding, create, and the text that we are giving it. Then we have the function to generate the reverse HyDE, which is based on the prompt, the prompt to our LM model. Given the following chunk, generate n different question that this chunk would be a good answer to. Then we provide a chunk, and we ask for multiple questions, and we want it to be enumerated so we can easily pass them. And then we call the OpenAI client to the GPT-3.5. Again, you can choose different LLM models here. It doesn't have to be OpenAI. We're using the embedding, and the generation's OpenAI…

内容