Building an LLM-Based Chat Service
Integrating a large language model (LLM) like OpenAI’s GPT-4o into a .NET project can significantly enhance its capabilities, offering advanced natural language processing (NLP), content generation, and more.
This chapter is about building an LLM-based chat service that will fine-tune a standard model with custom information, including a biography of this book’s author and information from the Northwind database. This allows the user to ask questions about the author and a fictional corporation’s database.
At the time of writing, cloud-based LLM APIs cost money. In this chapter, we will use one of the least expensive options: OpenAI’s GPT-3.5 Turbo. As OpenAI says, “GPT-3.5 Turbo is our fast and inexpensive model for simpler tasks. gpt-3.5-turbo-0125
is the flagship model of this family, supports a 16K context window and is optimized for dialog.” The input cost is US$0.50 / 1 M tokens. The...