## Conclusion

In this lab, you learned how to build two types of AI applications using Python, TiDB Cloud Starter, and OpenAI:

- **Retrieval-Augmented Generation (RAG):** You learned how to connect to TiDB Cloud Starter using `pytidb`, store text data along with its vector embeddings generated by OpenAI's `text-embedding-3-small` model, perform vector similarity searches to retrieve relevant context, and use a Large Language Model (LLM) like `gpt-4o` to generate answers based on the retrieved context. You also built a Streamlit interface to interact with the RAG system.
- **Text-to-SQL:** You explored how to leverage an LLM (`gpt-4o-mini`) to translate natural language questions into SQL queries. You learned how to provide table schemas from TiDB as context to the LLM for accurate SQL generation, execute the generated queries against TiDB, and format the results using another LLM call. This application was also presented through a Streamlit interface.
