{"id":22022,"date":"2024-10-17T19:23:10","date_gmt":"2024-10-18T02:23:10","guid":{"rendered":"https:\/\/www.pingcap.com\/?p=22022"},"modified":"2025-08-18T02:17:07","modified_gmt":"2025-08-18T09:17:07","slug":"building-generative-ai-applications-with-tidb-and-amazon-bedrock","status":"publish","type":"post","link":"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/","title":{"rendered":"Building Generative AI Applications with TiDB and Amazon Bedrock"},"content":{"rendered":"<p>In the rapidly evolving field of artificial intelligence, generative AI (GAI) stands out as one of the most fascinating and groundbreaking advancements. GAI represents a major leap forward, enabling machines to generate original and creative content across various domains, including conversations, stories, images, videos, and music. As companies seek to harness the potential of GAI, they not only require high-performance infrastructure but also a secure platform to protect their sensitive data and intellectual property. Large language models (LLMs) play a key role in this by understanding and generating text that mirrors human language, capturing its structure, meaning, and context.<\/p>\n\n\n\n<p>Vector search is a machine learning method that involves representing semantic concepts with numbers and comparing those records using machine learning AI models. It is a method in artificial intelligence and data retrieval that uses numerical vectors to represent and efficiently search through complex, unstructured data.<\/p>\n\n\n\n<p>In this blog, we will explore how to implement a Retrieval Augmented Generation (RAG) Q&amp;A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock. We&#8217;ll start by discussing the key components of a RAG architecture, then walk through how to set up TiDB as a vector database and integrate it with Amazon Bedrock to enable powerful vector search and text generation capabilities. Finally, we\u2019ll provide a step-by-step guide to implementing a working RAG solution and demonstrate how TiDB Cloud Serverless and Amazon Bedrock\u2019s Meta Llama 3 model can be combined to create a scalable, AI-driven Q&amp;A bot. <\/p>\n\n\n\n<p><a href=\"https:\/\/tidb.io\/\">PingCAP <\/a>and Amazon Web Services (AWS) understand this pressing need and have taken the lead in offering cutting-edge solutions to meet these demands. PingCAP, an <a href=\"https:\/\/partners.amazonaws.com\/partners\/0010h00001aBtIxAAK\/PingCAP\">AWS Partner Network (APN) Partner<\/a>, is the company behind <a href=\"\/ko\/tidb-self-managed\/\">\ud2f0DB<\/a>, an advanced open-source, <a href=\"\/ko\/blog\/why-distributed-sql-databases-elevate-modern-app-dev\/\">distributed SQL database<\/a> for building modern applications. TiDB is widely used and trusted by technologists around the world. Amazon Bedrock is a fully-managed service that makes high-performing foundation models (FMs) from leading AI companies and Amazon available for your use through a unified API. You can choose from a wide range of foundation models to find the model that is best suited for your use case. <a href=\"\/ko\/tidb-cloud-starter\/\">\ud2f0DB <\/a>is a scalable data store and vector database that offers a range of features to ensure exceptional search performance. <a href=\"https:\/\/docs.pingcap.com\/tidbcloud\/vector-search-overview\">TiDB&#8217;s vector store<\/a> provides a scalable, high-performance solution that can handle the storage, retrieval, and processing of vector data, making it ideal for AI applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Implement a RAG Q&amp;A Bot using TiDB and Amazon Bedrock<\/h2>\n\n\n\n<p>The solution below explains how to use a Retrieval Augmented Generation (RAG) Q&amp;A bot to demonstrate the vector search capability of <a href=\"\/ko\/tidb-cloud-starter\/\">TiDB Cloud \uc2a4\ud0c0\ud130<\/a>, a fully-managed auto-scaling TiDB cloud service, and the text generation capability of Meta Llama 3 on Bedrock.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution Overview<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"915\" src=\"https:\/\/static.pingcap.com\/files\/2024\/10\/17190354\/RAG-architecture.jpg\" alt=\"RAG architecture\" class=\"wp-image-22023\" srcset=\"https:\/\/static.pingcap.com\/files\/2024\/10\/17190354\/RAG-architecture.jpg 1280w, https:\/\/static.pingcap.com\/files\/2024\/10\/17190354\/RAG-architecture-300x214.jpg 300w, https:\/\/static.pingcap.com\/files\/2024\/10\/17190354\/RAG-architecture-1024x732.jpg 1024w, https:\/\/static.pingcap.com\/files\/2024\/10\/17190354\/RAG-architecture-768x549.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><figcaption class=\"wp-element-caption\">Figure 1: RAG architecture<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Based on the above diagram, there are two ways in which data flows through the application:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>The Ingestion Flow<\/strong>\n<ul class=\"wp-block-list\">\n<li>Documents are converted into vectors using the embeddings model on Amazon Bedrock and then they are stored in TiDB.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>The User Flow<\/strong>\n<ul class=\"wp-block-list\">\n<li>First, the User interacts with the custom application with the prompt.<\/li>\n\n\n\n<li>Then the custom application converts the prompt into embeddings.<\/li>\n\n\n\n<li>From there, the vectors are sent to custom applications and then to TiDB to find the paragraphs that contain the relevant context to the question that sits on S3.<\/li>\n\n\n\n<li>Next, those paragraphs \u2014 together with the prompt \u2014 are sent to the model.<\/li>\n\n\n\n<li>The model then generates the answer.<\/li>\n\n\n\n<li>Finally, the answer is sent back to the User.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Solution Walkthrough<\/h3>\n\n\n\n<p>In this section, we\u2019ll look at the steps required to setup and create a working RAG solution: <\/p>\n\n\n\n<p><strong>Prerequisites<\/strong><\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>In your development environment you should have\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.python.org\/downloads\/\">Python 3.11<\/a> or above<\/li>\n\n\n\n<li><a href=\"https:\/\/pypi.org\/project\/pip\/\">Pip<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/aws.amazon.com\/cli\/\">aws cli<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Follow these steps to <a href=\"https:\/\/docs.pingcap.com\/tidbcloud\/tidb-cloud-quickstart\">setup<\/a> a TiDB Cloud Serverless cluster.\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.pingcap.com\/tidbcloud\/dev-guide-sample-application-python-sqlalchemy#step-3-configure-connection-information\">Get the TiDB connection information<\/a> and set the environment variables on your development environment by running the following command in your terminal window (please replace the placeholder with the actual value you get from the TiDB Cloud web console).<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>export TIDB_HOST=&lt;your-tidb-host&gt;\nexport TIDB_PORT=4000\nexport TIDB_USER=&lt;your-tidb-user&gt;\nexport TIDB_PASSWORD=&lt;your-tidb-password&gt;\nexport TIDB_DB_NAME=test<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.aws.amazon.com\/bedrock\/latest\/userguide\/getting-started.html\">Set up<\/a> Amazon Bedrock in your AWS account.\n<ul class=\"wp-block-list\">\n<li>Ensure you have the <a href=\"https:\/\/docs.aws.amazon.com\/bedrock\/latest\/userguide\/security_iam_id-based-policy-examples.html\">necessary<\/a> permissions for Amazon Bedrock, and access to the amazon.titan-embed-text-v2:0 and us.meta.llama3-2-3b-instruct-v1:0 models. If you don\u2019t have access, follow the instructions <a href=\"https:\/\/docs.aws.amazon.com\/bedrock\/latest\/userguide\/getting-started.html#getting-started-model-access\">\uc5ec\uae30<\/a>.<\/li>\n\n\n\n<li>Ensure your AWS CLI profile is configured to a supported Amazon Bedrock region for this tutorial. You can find the list of supported regions at <a href=\"https:\/\/docs.aws.amazon.com\/bedrock\/latest\/userguide\/bedrock-regions.html\">Amazon Bedrock Regions<\/a>. Run \u2018aws configure set region &lt;your-region&gt;\u2019 to switch to a supported region.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><strong>Step 1: Set <\/strong><strong>u<\/strong><strong>p the Python <\/strong><strong>v<\/strong><strong>irtual <\/strong><strong>e<\/strong><strong>nvironment<\/strong><\/p>\n\n\n\n<p>Create a demo.py file. You then need to create a virtual environment to manage dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch demo.py\npython3 -m venv env\nsource env\/bin\/activate  # On Windows use env\\Scripts\\activate<\/code><\/pre>\n\n\n\n<p>Next, install the required dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install SQLAlchemy==2.0.30 PyMySQL==1.1.0 tidb-vector==0.0.9 pydantic==2.7.1 boto3<\/code><\/pre>\n\n\n\n<p><strong>Step 2: Import the necessary libraries<\/strong><\/p>\n\n\n\n<p>In demo.py, import the necessary libraries at the top of the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport json\nimport boto3\nfrom sqlalchemy import Column, Integer, Text, create_engine\nfrom sqlalchemy.orm import declarative_base, Session\nfrom tidb_vector.sqlalchemy import VectorType<\/code><\/pre>\n\n\n\n<p><strong>Step 3: Configur<\/strong><strong>e<\/strong><strong> database connections<\/strong><\/p>\n\n\n\n<p>Set up the database connection as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># ---- Configuration Setup ----\n# Set environment variables: TIDB_HOST, TIDB_PORT, TIDB_USER, TIDB_PASSWORD, TIDB_DB_NAME\nTIDB_HOST = os.environ.get(\"TIDB_HOST\")\nTIDB_PORT = os.environ.get(\"TIDB_PORT\")\nTIDB_USER = os.environ.get(\"TIDB_USER\")\nTIDB_PASSWORD = os.environ.get(\"TIDB_PASSWORD\")\nTIDB_DB_NAME = os.environ.get(\"TIDB_DB_NAME\")\n\n# ---- Database Setup ----\ndef get_db_url():\n    \"\"\"Build the database connection URL.\"\"\"\n    return f\"mysql+pymysql:\/\/{TIDB_USER}:{TIDB_PASSWORD}@{TIDB_HOST}:{TIDB_PORT}\/{TIDB_DB_NAME}?ssl_verify_cert=True&amp;ssl_verify_identity=True\"\n\n# Create engine\nengine = create_engine(get_db_url(), pool_recycle=300)\nBase = declarative_base()<\/code><\/pre>\n\n\n\n<p><strong>Step 4: Invoke the Amazon Titan Text Embeddings V2 model using the bedrock runtime client<\/strong> <\/p>\n\n\n\n<p>The Amazon Bedrock runtime client provides you with an API invoke_model which accepts the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>modelId<\/strong>: This is the model ID for the foundation model available in Amazon Bedrock.<\/li>\n\n\n\n<li><strong>accept<\/strong>: The type of input request.<\/li>\n\n\n\n<li><strong>contentType<\/strong>: The content type of the input.<\/li>\n\n\n\n<li><strong>body<\/strong>: A JSON string payload consisting of the prompt and the configurations.<\/li>\n<\/ul>\n\n\n\n<p>We\u2019ll now use the Amazon Bedrock\u2019s invoke_model API to generate text embeddings using Amazon Titan Text Embeddings and responses from Meta Llama 3 with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Bedrock Runtime Client Setup\nbedrock_runtime = boto3.client('bedrock-runtime')\n\n# ---- Model Invocation ----\nembedding_model_name = \"amazon.titan-embed-text-v2:0\"\ndim_of_embedding_model = 512\nllm_name = \"us.meta.llama3-2-3b-instruct-v1:0\"\n\n\ndef embedding(content):\n    \"\"\"Invoke Amazon Bedrock to get text embeddings.\"\"\"\n    payload = {\n        \"modelId\": embedding_model_name,\n        \"contentType\": \"application\/json\",\n        \"accept\": \"*\/*\",\n        \"body\": {\n            \"inputText\": content,\n            \"dimensions\": dim_of_embedding_model,\n            \"normalize\": True,\n        }\n    }\n    \n    body_bytes = json.dumps(payload&#91;'body']).encode('utf-8')\n    \n    response = bedrock_runtime.invoke_model(\n        body=body_bytes,\n        contentType=payload&#91;'contentType'],\n        accept=payload&#91;'accept'],\n        modelId=payload&#91;'modelId']\n    )\n    \n    result_body = json.loads(response.get(\"body\").read())\n    return result_body.get(\"embedding\")\n\n\ndef generate_result(query: str, info_str: str):\n    \"\"\"Generate answer using Meta Llama 3 model.\"\"\"\n    prompt = f\"\"\"\n    ONLY use the content below to generate an answer:\n    {info_str}\n\n    ----\n    Please carefully think about the question: {query}\n    \"\"\"\n    \n    payload = {\n        \"modelId\": llm_name,\n        \"contentType\": \"application\/json\",\n        \"accept\": \"application\/json\",\n        \"body\": {\n            \"prompt\": prompt,\n            \"temperature\": 0\n        }\n    }\n\n    body_bytes = json.dumps(payload&#91;'body']).encode('utf-8')\n\n    response = bedrock_runtime.invoke_model(\n        body=body_bytes,\n        contentType=payload&#91;'contentType'],\n        accept=payload&#91;'accept'],\n        modelId=payload&#91;'modelId']\n    )\n    \n    result_body = json.loads(response.get(\"body\").read())\n    completion = result_body&#91;\"generation\"]\n    return completion<\/code><\/pre>\n\n\n\n<p><strong>Step 5: Create <\/strong><strong>the <\/strong><strong>table and its vector index in <\/strong><strong>\ud2f0DB <\/strong><strong>Cloud<\/strong><strong>Serverless<\/strong><strong> to store text and vector<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># ---- TiDB Setup and Vector Index Creation ----\nclass Entity(Base):\n    \"\"\"Define the Entity table with a vector index.\"\"\"\n    __tablename__ = \"entity\"\n    id = Column(Integer, primary_key=True)\n    content = Column(Text)\n    content_vec = Column(VectorType(dim=dim_of_embedding_model), comment=\"hnsw(distance=l2)\")\n\n# Create the table in TiDB\nBase.metadata.create_all(engine)<\/code><\/pre>\n\n\n\n<p><strong>Step 6: Save <\/strong><strong>v<\/strong><strong>ector to <\/strong><strong>\ud2f0DB <\/strong><strong>Cloud<\/strong><strong>Serverless<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># ---- Saving Vectors to TiDB ----\ndef save_entities_with_embedding(session, contents):\n    \"\"\"Save multiple entities with their embeddings to the TiDB Serverless database.\"\"\"\n    for content in contents:\n        entity = Entity(content=content, content_vec=embedding(content))\n        session.add(entity)\n    session.commit()<\/code><\/pre>\n\n\n\n<p><strong>Step 7: Put <\/strong><strong>i<\/strong><strong>t <\/strong><strong>a<\/strong><strong>ll <\/strong><strong>t<\/strong><strong>ogether<\/strong><\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Establish the database session.<\/li>\n\n\n\n<li>Save embeddings to TiDB.<\/li>\n\n\n\n<li>Ask an example question such as \u201cWhat is TiDB?\u201c<\/li>\n\n\n\n<li>Generate results from the model.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>if __name__ == \"__main__\":\n    # Establish a database session\n    with Session(engine) as session:\n        # Example data\n        contents = &#91;\n            \"TiDB is a distributed SQL database compatible with MySQL.\",\n            \"TiDB supports Hybrid Transactional and Analytical Processing (HTAP).\",\n            \"TiDB can scale horizontally and provides high availability.\",\n            \"Amazon Bedrock allows seamless integration with foundation models.\",\n            \"Meta Llama 3 is a powerful model for text generation.\"\n        ]\n        \n        # Save embeddings to TiDB\n        save_entities_with_embedding(session, contents)\n        \n        # Example query\n        query = \"What is TiDB?\"\n        info_str = \" \".join(contents)\n        \n        # Generate result from Meta Llama 3\n        result = generate_result(query, info_str)\n        print(f\"Generated answer: {result}\")<\/code><\/pre>\n\n\n\n<p>Finally, save the file, go back to the terminal window, and run the script. You should now see a similar output as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 main.py\nGenerated answer:  What is the main purpose of TiDB?\n     What are the key features of TiDB?\n     What are the key benefits of TiDB?\n\n    ----\n    Based on the provided text, here is the answer to the question:\n    What is TiDB?\n    TiDB is a distributed SQL database compatible with MySQL.\n```\n\n## Step 1: Understand the question\nThe question asks for the definition of TiDB.\n\n## Step 2: Identify the key information\nThe key information provided in the text is that TiDB is a distributed SQL database compatible with MySQL.\n\n## Step 3: Provide the answer\nBased on the provided text, TiDB is a distributed SQL database compatible with MySQL.\n\nThe final answer is: TiDB is a distributed SQL database compatible with MySQL.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In this post, we demonstrated how to build a RAG application, save the information to TiDB Cloud Serverless, and use the vector search feature in TiDB Cloud Serverless to obtain information. From there, we used that information to generate the answer via Meta Llama 3. Finally, we used TiDB and the Meta Llama 3 model through the Amazon Bedrock API with Boto3 SDK. You can find the full code <a href=\"https:\/\/github.com\/Icemap\/aws-generativeai-partner-samples\/blob\/feat-tidb\/tidb\/samples\/tidb-bedrock-boto3-rag.ipynb\">\uc5ec\uae30<\/a> in Notebook format. <\/p>\n\n\n\n<p>Want to build this application on your own? Start a <a href=\"https:\/\/tidbcloud.com\/free-trial\/\" data-gtag=\"event:go_to_cloud_signup,product_type:serverless,button_name:Sign Up for Free,position:blog_bottom\">free trial of TiDB Cloud Serverless<\/a> today.<\/p>","protected":false},"excerpt":{"rendered":"<p>In the rapidly evolving field of artificial intelligence, generative AI (GAI) stands out as one of the most fascinating and groundbreaking advancements. GAI represents a major leap forward, enabling machines to generate original and creative content across various domains, including conversations, stories, images, videos, and music. As companies seek to harness the potential of GAI, [&hellip;]<\/p>\n","protected":false},"author":277,"featured_media":22025,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[13],"tags":[298,208,29,297],"class_list":["post-22022","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-product","tag-rag","tag-tidb-serverless","tag-tutorial","tag-vector-search"],"acf":[],"featured_image_src":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg","author_info":{"display_name":"Akshata Raghunatha","author_link":"https:\/\/www.pingcap.com\/ko\/blog\/author\/akshata-raghunatha\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Building Generative AI Applications with TiDB and Amazon Bedrock<\/title>\n<meta name=\"description\" content=\"Explore how to implement a Retrieval Augmented Generation (RAG) Q&amp;A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building Generative AI Applications with TiDB and Amazon Bedrock\" \/>\n<meta property=\"og:description\" content=\"Explore how to implement a Retrieval Augmented Generation (RAG) Q&amp;A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\" \/>\n<meta property=\"og:site_name\" content=\"TiDB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/pingcap2015\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-18T02:23:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-18T09:17:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191827\/20241018-095528.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"2500\" \/>\n\t<meta property=\"og:image:height\" content=\"1307\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Akshata Raghunatha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191827\/20241018-095528.jpeg\" \/>\n<meta name=\"twitter:creator\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:site\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Akshata Raghunatha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\"},\"author\":{\"name\":\"Akshata Raghunatha\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/d691fe441dc0b254e7b5f4eea08a7cb4\"},\"headline\":\"Building Generative AI Applications with TiDB and Amazon Bedrock\",\"datePublished\":\"2024-10-18T02:23:10+00:00\",\"dateModified\":\"2025-08-18T09:17:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\"},\"wordCount\":1078,\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg\",\"keywords\":[\"RAG\",\"TiDB Serverless\",\"Tutorial\",\"Vector Search\"],\"articleSection\":[\"Product\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\",\"url\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\",\"name\":\"Building Generative AI Applications with TiDB and Amazon Bedrock\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg\",\"datePublished\":\"2024-10-18T02:23:10+00:00\",\"dateModified\":\"2025-08-18T09:17:07+00:00\",\"description\":\"Explore how to implement a Retrieval Augmented Generation (RAG) Q&A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage\",\"url\":\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg\",\"width\":2560,\"height\":853,\"caption\":\"Amazon-Bedrock-TiDB\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pingcap.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Generative AI Applications with TiDB and Amazon Bedrock\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pingcap.com\/#website\",\"url\":\"https:\/\/www.pingcap.com\/\",\"name\":\"TiDB\",\"description\":\"TiDB | SQL at Scale\",\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pingcap.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pingcap.com\/#organization\",\"name\":\"PingCAP\",\"url\":\"https:\/\/www.pingcap.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"width\":811,\"height\":232,\"caption\":\"PingCAP\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/pingcap2015\",\"https:\/\/x.com\/PingCAP\",\"https:\/\/linkedin.com\/company\/pingcap\",\"https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/d691fe441dc0b254e7b5f4eea08a7cb4\",\"name\":\"Akshata Raghunatha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"caption\":\"Akshata Raghunatha\"},\"description\":\"Partner Solutions Architect, AWS\",\"url\":\"https:\/\/www.pingcap.com\/ko\/blog\/author\/akshata-raghunatha\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building Generative AI Applications with TiDB and Amazon Bedrock","description":"Explore how to implement a Retrieval Augmented Generation (RAG) Q&A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/","og_locale":"ko_KR","og_type":"article","og_title":"Building Generative AI Applications with TiDB and Amazon Bedrock","og_description":"Explore how to implement a Retrieval Augmented Generation (RAG) Q&A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.","og_url":"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/","og_site_name":"TiDB","article_publisher":"https:\/\/facebook.com\/pingcap2015","article_published_time":"2024-10-18T02:23:10+00:00","article_modified_time":"2025-08-18T09:17:07+00:00","og_image":[{"width":2500,"height":1307,"url":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191827\/20241018-095528.jpeg","type":"image\/jpeg"}],"author":"Akshata Raghunatha","twitter_card":"summary_large_image","twitter_image":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191827\/20241018-095528.jpeg","twitter_creator":"@PingCAP","twitter_site":"@PingCAP","twitter_misc":{"Written by":"Akshata Raghunatha","Est. reading time":"9\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#article","isPartOf":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/"},"author":{"name":"Akshata Raghunatha","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/d691fe441dc0b254e7b5f4eea08a7cb4"},"headline":"Building Generative AI Applications with TiDB and Amazon Bedrock","datePublished":"2024-10-18T02:23:10+00:00","dateModified":"2025-08-18T09:17:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/"},"wordCount":1078,"publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg","keywords":["RAG","TiDB Serverless","Tutorial","Vector Search"],"articleSection":["Product"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/","url":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/","name":"Building Generative AI Applications with TiDB and Amazon Bedrock","isPartOf":{"@id":"https:\/\/www.pingcap.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg","datePublished":"2024-10-18T02:23:10+00:00","dateModified":"2025-08-18T09:17:07+00:00","description":"Explore how to implement a Retrieval Augmented Generation (RAG) Q&A bot using PingCAP\u2019s TiDB Cloud Serverless and Amazon Bedrock.","breadcrumb":{"@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#primaryimage","url":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg","contentUrl":"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg","width":2560,"height":853,"caption":"Amazon-Bedrock-TiDB"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pingcap.com\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pingcap.com\/"},{"@type":"ListItem","position":2,"name":"Building Generative AI Applications with TiDB and Amazon Bedrock"}]},{"@type":"WebSite","@id":"https:\/\/www.pingcap.com\/#website","url":"https:\/\/www.pingcap.com\/","name":"\ud2f0DB","description":"TiDB | SQL at Scale","publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pingcap.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.pingcap.com\/#organization","name":"PingCAP","url":"https:\/\/www.pingcap.com\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","width":811,"height":232,"caption":"PingCAP"},"image":{"@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/pingcap2015","https:\/\/x.com\/PingCAP","https:\/\/linkedin.com\/company\/pingcap","https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA"]},{"@type":"Person","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/d691fe441dc0b254e7b5f4eea08a7cb4","name":"Akshata Raghunatha","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/","url":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","contentUrl":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","caption":"Akshata Raghunatha"},"description":"Partner Solutions Architect, AWS","url":"https:\/\/www.pingcap.com\/ko\/blog\/author\/akshata-raghunatha\/"}]}},"grav_blocks":false,"card_markup":"<a class=\"card-resource bg-white\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/building-generative-ai-applications-with-tidb-and-amazon-bedrock\/\"><div class=\"card-resource__image-container\"><img class=\"card-resource__image\" alt=\"Amazon-Bedrock-TiDB\" src=\"https:\/\/static.pingcap.com\/files\/2024\/10\/17191333\/20241018-095521-scaled.jpeg\" loading=\"lazy\" width=2560 height=853 \/><\/div><div class=\"card-resource__content-container\"><div class=\"card-resource__content-head\"><div class=\"card-resource__category\">Product<\/div><\/div><h5 class=\"card-resource__title\">Building Generative AI Applications with TiDB and Amazon Bedrock<\/h5><\/div><\/a>","_links":{"self":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/22022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/users\/277"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/comments?post=22022"}],"version-history":[{"count":8,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/22022\/revisions"}],"predecessor-version":[{"id":28967,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/22022\/revisions\/28967"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media\/22025"}],"wp:attachment":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media?parent=22022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/categories?post=22022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/tags?post=22022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}