{"id":53910,"date":"2025-09-21T16:30:34","date_gmt":"2025-09-21T06:30:34","guid":{"rendered":"https:\/\/www.cloudproinc.com.au\/?p=53910"},"modified":"2025-09-21T16:56:26","modified_gmt":"2025-09-21T06:56:26","slug":"build-a-chat-bot-with-streamlit","status":"publish","type":"post","link":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/","title":{"rendered":"Build a Chat Bot with Streamlit"},"content":{"rendered":"\n<p>In this blog post Build a Chat Bot with Streamlit An End to End Guide for Teams we will walk through how to design, build, and deploy a production-ready chat bot using Streamlit and modern large language models (LLMs).<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Build a Chat Bot with <a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/category\/streamlit\/\">Streamlit<\/a> An End to End Guide for Teams is about blending a fast UI framework with powerful AI. Streamlit turns Python scripts into web apps in minutes. LLMs add natural conversation, reasoning, and task execution. Together, they let technical teams prototype in hours and iterate toward production confidently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-why-streamlit-for-chat-bots\">Why Streamlit for chat bots<\/h2>\n\n\n\n<p>Streamlit is Python-first, reactive, and batteries-included. You write simple code, and it handles layout, state, forms, caching, and auth (via secrets). For chat experiences, Streamlit provides native chat components, quick data viz, and frictionless deployment options. For managers, this means short time-to-value and low operational overhead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-chat-bots-work-at-a-high-level\">How chat bots work at a high level<\/h2>\n\n\n\n<p>Modern chat bots have three core layers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Interface: a responsive chat UI that captures messages and renders responses.<\/li>\n\n\n\n<li>Reasoning: an LLM that interprets intent, maintains context, and drafts replies.<\/li>\n\n\n\n<li>Knowledge and tools: optional retrieval (RAG) or function calls to fetch data or act.<\/li>\n<\/ul>\n\n\n\n<p>Streamlit handles the interface and app state. An LLM provider (OpenAI, Azure OpenAI, Anthropic, etc.) powers reasoning. A vector store or API integrations provide grounded knowledge. The result is a conversational UI that is both helpful and reliable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-the-key-technologies-behind-this-stack\">The key technologies behind this stack<\/h2>\n\n\n\n<p>Here is the main technology you will use and why it matters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Streamlit: reactive Python web app framework with chat widgets (<code>st.chat_input<\/code>, <code>st.chat_message<\/code>), caching (<code>st.cache_*<\/code>), and session state.<\/li>\n\n\n\n<li>LLM API: a hosted model endpoint (e.g., OpenAI) for chat completions and function\/tool calling.<\/li>\n\n\n\n<li>Embeddings and vector search (optional): FAISS or a managed vector DB to retrieve relevant documents for RAG.<\/li>\n\n\n\n<li>Secrets management: Streamlit secrets or environment variables to store API keys safely.<\/li>\n\n\n\n<li>Containerization\/deployment: Streamlit Community Cloud, Docker on AWS\/GCP\/Azure, or an internal platform.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-architecture-overview\">Architecture overview<\/h2>\n\n\n\n<p>A minimal app flows like this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Initialize session state for the chat transcript.<\/li>\n\n\n\n<li>Render prior messages; capture new user input.<\/li>\n\n\n\n<li>Send the conversation context and user message to an LLM API.<\/li>\n\n\n\n<li>Optionally, augment with retrieved context (RAG) before calling the LLM.<\/li>\n\n\n\n<li>Stream or display the model response; persist to session state.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Python 3.9+<\/li>\n\n\n\n<li><code>pip install streamlit openai<\/code> (or your preferred LLM client)<\/li>\n\n\n\n<li>Set <code>OPENAI_API_KEY<\/code> (or relevant provider key) in your environment or <code>.streamlit\/secrets.toml<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-build-a-minimal-chat-ui\">Step 1 Build a minimal chat UI<\/h2>\n\n\n\n<p>This is the smallest useful Streamlit chat bot. It remembers history and calls an LLM.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-16444f35c211dd24a923d3b40aaa05cb\"><code>import os\nimport streamlit as st\nfrom openai import OpenAI\n\nst.set_page_config(page_title=\"Streamlit Chat Bot\", page_icon=\"\ud83e\udd16\", layout=\"centered\")\n\n# Initialize LLM client\nclient = OpenAI(api_key=os.getenv(\"OPENAI_API_KEY\"))\n\n# Initialize chat history in session state\nif \"messages\" not in st.session_state:\n    st.session_state.messages = &#91;\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}\n    ]\n\nst.title(\"Streamlit Chat Bot\")\n\n# Render history (skip system in UI)\nfor msg in st.session_state.messages:\n    if msg&#91;\"role\"] == \"system\":\n        continue\n    with st.chat_message(msg&#91;\"role\"]):\n        st.markdown(msg&#91;\"content\"])\n\n# Chat input\nif prompt := st.chat_input(\"Ask me anything\"):\n    # Add user message\n    st.session_state.messages.append({\"role\": \"user\", \"content\": prompt})\n\n    # Display user message immediately\n    with st.chat_message(\"user\"):\n        st.markdown(prompt)\n\n    # Get LLM response\n    with st.chat_message(\"assistant\"):\n        with st.spinner(\"Thinking...\"):\n            completion = client.chat.completions.create(\n                model=\"gpt-4o-mini\",  # or your preferred model\n                messages=st.session_state.messages,\n                temperature=0.2,\n            )\n            reply = completion.choices&#91;0].message.content\n            st.markdown(reply)\n\n    # Save assistant reply\n    st.session_state.messages.append({\"role\": \"assistant\", \"content\": reply})\n<\/code><\/pre>\n\n\n\n<p>Run with <code>streamlit run app.py<\/code> and you\u2019ll have a functional chat bot.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-make-it-feel-fast-with-streaming\">Make it feel fast with streaming<\/h3>\n\n\n\n<p>Streaming small chunks improves perceived performance.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1f69db374a4e64efa36e82bac77fd252\"><code>with st.chat_message(\"assistant\"):\n    placeholder = st.empty()\n    collected = &#91;]\n    for chunk in client.chat.completions.create(\n        model=\"gpt-4o-mini\",\n        messages=st.session_state.messages,\n        stream=True,\n        temperature=0.2,\n    ):\n        delta = chunk.choices&#91;0].delta.content or \"\"\n        collected.append(delta)\n        placeholder.markdown(\"\".join(collected))\n    reply = \"\".join(collected)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-manage-state-and-prompts-responsibly\">Step 2 Manage state and prompts responsibly<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Keep a short, clear system prompt that sets persona and constraints.<\/li>\n\n\n\n<li>Truncate long histories to control latency and cost.<\/li>\n\n\n\n<li>Store only what you need; avoid logging secrets or PII.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-6200abf5dcedcd4173a00dd98cb5d919\"><code>def trimmed_history(messages, max_tokens=2000):\n    # Simple heuristic: keep last N messages; for production, measure tokens\n    keep = &#91;]\n    for m in reversed(messages):\n        keep.append(m)\n        if len(keep) &gt; 10:  # tune as needed\n            break\n    return list(reversed(keep))\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-add-retrieval-for-accurate-answers-rag\">Step 3 Add retrieval for accurate answers (RAG)<\/h2>\n\n\n\n<p>Retrieval Augmented Generation lets the bot cite your documents rather than guessing. Below is a lightweight local approach using sentence embeddings and FAISS.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Index: compute embeddings for your documents and build a FAISS index.<\/li>\n\n\n\n<li>Retrieve: on each question, get top-k chunks and pass them to the model.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-06a8b80392d03918263d7632952d3147\"><code># pip install faiss-cpu sentence-transformers\nimport faiss\nfrom sentence_transformers import SentenceTransformer\n\nEMB_MODEL = SentenceTransformer('sentence-transformers\/all-MiniLM-L6-v2')\n\n# Build the index once (cache it for speed)\n@st.cache_resource\ndef build_index(docs: list&#91;str]):\n    vectors = EMB_MODEL.encode(docs, normalize_embeddings=True)\n    index = faiss.IndexFlatIP(vectors.shape&#91;1])\n    index.add(vectors)\n    return index, vectors\n\n# Example documents\nDOCS = &#91;\n    \"Company policy: Support hours are 9am-5pm AEST, Mon-Fri.\",\n    \"Refunds are processed within 7 business days.\",\n    \"To reset your password, use the account settings page.\",\n]\nINDEX, DOC_VECS = build_index(DOCS)\n\ndef retrieve(query, k=3):\n    qv = EMB_MODEL.encode(&#91;query], normalize_embeddings=True)\n    D, I = INDEX.search(qv, k)\n    return &#91;DOCS&#91;i] for i in I&#91;0]]\n\n# In your chat handler\ncontext = \"\\n\".join(retrieve(prompt))\nrag_system_prompt = (\n    \"You are a helpful assistant. Use the provided context to answer. \"\n    \"If the answer is not in the context, say you do not know.\\n\\n\"\n    f\"Context:\\n{context}\\n\\n\"\n)\nmessages = &#91;{\"role\": \"system\", \"content\": rag_system_prompt}] + trimmed_history(\n    st.session_state.messages\n)\ncompletion = client.chat.completions.create(\n    model=\"gpt-4o-mini\",\n    messages=messages,\n    temperature=0.1,\n)\n<\/code><\/pre>\n\n\n\n<p>For larger corpora, consider a managed vector DB (Pinecone, Weaviate, Qdrant Cloud) and chunking PDFs\/HTML via loaders.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-4-add-tool-use-and-function-calling\">Step 4 Add tool use and function calling<\/h2>\n\n\n\n<p>Use LLM tool calling to let the bot fetch live data or perform actions. Define tool schemas and route model requests to Python functions.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1a0874d44bccb973e1f3e7e4f37a2f21\"><code>tools = &#91;\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"get_support_hours\",\n            \"description\": \"Return current support hours by region\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {\"region\": {\"type\": \"string\"}}, \"required\": &#91;\"region\"]},\n        },\n    }\n]\n\ndef get_support_hours(region: str):\n    return {\"AEST\": \"9am-5pm Mon-Fri\", \"PST\": \"9am-5pm Mon-Fri\"}.get(region, \"Unknown\")\n\nresp = client.chat.completions.create(\n    model=\"gpt-4o-mini\",\n    messages=st.session_state.messages,\n    tools=tools,\n)\nchoice = resp.choices&#91;0]\nif choice.finish_reason == \"tool_calls\":\n    for call in choice.message.tool_calls:\n        if call.function.name == \"get_support_hours\":\n            import json\n            args = json.loads(call.function.arguments)\n            result = get_support_hours(args&#91;\"region\"])  \n            st.session_state.messages.append({\n                \"role\": \"tool\",\n                \"tool_call_id\": call.id,\n                \"name\": \"get_support_hours\",\n                \"content\": str(result),\n            })\n    # Send tool results back to the model\n    final = client.chat.completions.create(\n        model=\"gpt-4o-mini\",\n        messages=st.session_state.messages,\n    )\n    reply = final.choices&#91;0].message.content\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-5-evaluate-and-observe\">Step 5 Evaluate and observe<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Golden sets: keep a small suite of Q&amp;A pairs that the bot should answer.<\/li>\n\n\n\n<li>Telemetry: log prompts, response times, token usage (exclude PII).<\/li>\n\n\n\n<li>User feedback: add a thumbs up\/down and capture rationale.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-873e3020af234af0ba55cb17bb5bec53\"><code>fb = st.radio(\"Was this helpful?\", &#91;\"\ud83d\udc4d\", \"\ud83d\udc4e\"], horizontal=True, key=f\"fb_{len(st.session_state.messages)}\")\nif fb:\n    st.session_state.setdefault(\"feedback\", &#91;]).append({\"msg\": prompt, \"fb\": fb})\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-security-privacy-and-governance\">Security, privacy, and governance<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Secrets: store API keys in <code>.streamlit\/secrets.toml<\/code>, not in code or git.<\/li>\n\n\n\n<li>PII: mask or avoid sending PII to third-party providers.<\/li>\n\n\n\n<li>Rate limits: add retry\/backoff; degrade gracefully on provider outages.<\/li>\n\n\n\n<li>Allow-list tools and sanitize tool inputs\/outputs.<\/li>\n\n\n\n<li>Model choice: prefer enterprise offerings with data controls (e.g., Azure OpenAI with no training on inputs).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cost-and-latency-control\">Cost and latency control<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use small models for routine turns; escalate to larger models only when needed.<\/li>\n\n\n\n<li>Trim history and context; use retrieval to provide only relevant chunks.<\/li>\n\n\n\n<li>Cache expensive retrieval with <code>st.cache_data<\/code>.<\/li>\n\n\n\n<li>Batch background jobs; set <code>max_tokens<\/code> thoughtfully.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-packaging-and-configuration\">Packaging and configuration<\/h2>\n\n\n\n<p>Add a simple <code>requirements.txt<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-2cec873326b5268a53f8673f93a8a01e\"><code>streamlit==1.37.0\nopenai&gt;=1.30.0\nfaiss-cpu\nsentence-transformers\n<\/code><\/pre>\n\n\n\n<p>And a minimal <code>.streamlit\/secrets.toml<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-33fb4ead242e08f407b43159d67cbf1c\"><code>OPENAI_API_KEY = \"&lt;your-key&gt;\"\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-deployment-options\">Deployment options<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-streamlit-community-cloud\">Streamlit Community Cloud<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Push to GitHub.<\/li>\n\n\n\n<li>Connect the repo in Streamlit Cloud.<\/li>\n\n\n\n<li>Add secrets in the dashboard; deploy.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-docker-on-your-cloud\">Docker on your cloud<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-70e328b8e58915fa3a76224b24359259\"><code># Dockerfile\nFROM python:3.11-slim\nWORKDIR \/app\nCOPY requirements.txt .\/\nRUN pip install --no-cache-dir -r requirements.txt\nCOPY . .\nEXPOSE 8501\nENV PYTHONUNBUFFERED=1\nCMD &#91;\"streamlit\", \"run\", \"app.py\", \"--server.port=8501\", \"--server.address=0.0.0.0\"]\n<\/code><\/pre>\n\n\n\n<p>Run locally with:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-865ee0caf2d82878d945f91de6f91622\"><code>docker build -t streamlit-chat .\ndocker run -p 8501:8501 -e OPENAI_API_KEY=$OPENAI_API_KEY streamlit-chat<\/code><\/pre>\n\n\n\n<p>Then deploy the image to ECS, Cloud Run, AKS, or your platform of choice. Add autoscaling and a load balancer for production traffic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-common-pitfalls-and-how-to-avoid-them\">Common pitfalls and how to avoid them<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Endless context growth: trim or summarize older turns.<\/li>\n\n\n\n<li>Hallucinations: use RAG and instruct the model to admit uncertainty.<\/li>\n\n\n\n<li>Slow responses: stream tokens and prefetch retrieval.<\/li>\n\n\n\n<li>Inconsistent answers: standardize system prompts and temperature.<\/li>\n\n\n\n<li>Key leakage: keep credentials in secrets; never print them in logs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-good-looks-like\">What good looks like<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clear, concise system prompt that aligns with your domain.<\/li>\n\n\n\n<li>Fast first token via streaming and lightweight models.<\/li>\n\n\n\n<li>Grounded answers with citations from your knowledge base.<\/li>\n\n\n\n<li>Audit trail of prompts, context, and decisions.<\/li>\n\n\n\n<li>Automated deployments and rollbacks with container images.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-next-steps\">Next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add user auth and role-based access to tailor answers by department.<\/li>\n\n\n\n<li>Support file uploads and on-the-fly indexing for ad-hoc documents.<\/li>\n\n\n\n<li>Introduce analytics on conversation quality and deflection rates.<\/li>\n\n\n\n<li>Experiment with tool calling to integrate internal APIs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-wrap-up\">Wrap up<\/h2>\n\n\n\n<p>Streamlit plus a modern LLM is a powerful, pragmatic foundation for chat experiences. Start small with the minimal app, add retrieval for trustworthy answers, and layer in tools and deployment. With careful attention to state, cost, and governance, you can ship a helpful bot quickly\u2014and improve it continuously as your users engage.<\/p>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links yoast-seo-related-links\">\n<li><a href=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/20\/build-data-driven-apps-with-streamlit\/\">Build Data Driven Apps With Streamlit<\/a><\/li>\n\n\n\n<li><a href=\"null\">Build a Conversational Language Bot with Azure AI Language<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/15\/preparing-input-text-for-training-llms\/\">Preparing Input Text for Training LLMs<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/15\/architecture-of-rag-building-reliable-retrieval-augmented-ai\/\">Architecture of RAG Building Reliable Retrieval Augmented AI<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cloudproinc.azurewebsites.net\/index.php\/2025\/05\/18\/add-an-eye-catching-pop-up-to-your-sharepoint-online-site\/\">Add an Eye-Catching Pop-Up to Your SharePoint Online Site<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A practical, friendly guide to designing, building, and shipping a Streamlit chat bot with modern LLMs, retrieval, and secure deployment for teams.<\/p>\n","protected":false},"author":1,"featured_media":53911,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"Build a Chat Bot with Streamlit","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[24,13,89],"tags":[],"class_list":["post-53910","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-blog","category-streamlit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Build a Chat Bot with Streamlit - CPI Consulting<\/title>\n<meta name=\"description\" content=\"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build a Chat Bot with Streamlit\" \/>\n<meta property=\"og:description\" content=\"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/\" \/>\n<meta property=\"og:site_name\" content=\"CPI Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-21T06:30:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-21T06:56:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CPI Staff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CPI Staff\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/\"},\"author\":{\"name\":\"CPI Staff\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\"},\"headline\":\"Build a Chat Bot with Streamlit\",\"datePublished\":\"2025-09-21T06:30:34+00:00\",\"dateModified\":\"2025-09-21T06:56:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/\"},\"wordCount\":994,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png\",\"articleSection\":[\"AI\",\"Blog\",\"Streamlit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/\",\"name\":\"Build a Chat Bot with Streamlit - CPI Consulting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#primaryimage\"},\"thumbnailUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png\",\"datePublished\":\"2025-09-21T06:30:34+00:00\",\"dateModified\":\"2025-09-21T06:56:26+00:00\",\"description\":\"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#primaryimage\",\"url\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/2025\\\/09\\\/21\\\/build-a-chat-bot-with-streamlit\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudproinc.com.au\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build a Chat Bot with Streamlit\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#website\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/\",\"name\":\"Cloud Pro Inc - CPI Consulting Pty Ltd\",\"description\":\"Cloud, AI &amp; Cybersecurity Consulting | Melbourne\",\"publisher\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cloudproinc.com.au\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#organization\",\"name\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\",\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"contentUrl\":\"\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/favfinalfile.png\",\"width\":500,\"height\":500,\"caption\":\"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cloudproinc.com.au\\\/#\\\/schema\\\/person\\\/192eeeb0ce91062126ce3822ae88fe6e\",\"name\":\"CPI Staff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g\",\"caption\":\"CPI Staff\"},\"sameAs\":[\"http:\\\/\\\/www.cloudproinc.com.au\"],\"url\":\"https:\\\/\\\/cloudproinc.com.au\\\/index.php\\\/author\\\/cpiadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build a Chat Bot with Streamlit - CPI Consulting","description":"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.","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:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/","og_locale":"en_US","og_type":"article","og_title":"Build a Chat Bot with Streamlit","og_description":"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.","og_url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/","og_site_name":"CPI Consulting","article_published_time":"2025-09-21T06:30:34+00:00","article_modified_time":"2025-09-21T06:56:26+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/cloudproinc.com.au\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","type":"image\/png"}],"author":"CPI Staff","twitter_card":"summary_large_image","twitter_misc":{"Written by":"CPI Staff","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#article","isPartOf":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/"},"author":{"name":"CPI Staff","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e"},"headline":"Build a Chat Bot with Streamlit","datePublished":"2025-09-21T06:30:34+00:00","dateModified":"2025-09-21T06:56:26+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/"},"wordCount":994,"commentCount":0,"publisher":{"@id":"https:\/\/cloudproinc.com.au\/#organization"},"image":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","articleSection":["AI","Blog","Streamlit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/","url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/","name":"Build a Chat Bot with Streamlit - CPI Consulting","isPartOf":{"@id":"https:\/\/cloudproinc.com.au\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#primaryimage"},"image":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","datePublished":"2025-09-21T06:30:34+00:00","dateModified":"2025-09-21T06:56:26+00:00","description":"Learn how to Build a Chat Bot with Streamlit in this comprehensive guide for teams using modern language models.","breadcrumb":{"@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#primaryimage","url":"\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","contentUrl":"\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/21\/build-a-chat-bot-with-streamlit\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudproinc.com.au\/"},{"@type":"ListItem","position":2,"name":"Build a Chat Bot with Streamlit"}]},{"@type":"WebSite","@id":"https:\/\/cloudproinc.com.au\/#website","url":"https:\/\/cloudproinc.com.au\/","name":"Cloud Pro Inc - CPI Consulting Pty Ltd","description":"Cloud, AI &amp; Cybersecurity Consulting | Melbourne","publisher":{"@id":"https:\/\/cloudproinc.com.au\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudproinc.com.au\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudproinc.com.au\/#organization","name":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd","url":"https:\/\/cloudproinc.com.au\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/logo\/image\/","url":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","contentUrl":"\/wp-content\/uploads\/2022\/01\/favfinalfile.png","width":500,"height":500,"caption":"Cloud Pro Inc - Cloud Pro Inc - CPI Consulting Pty Ltd"},"image":{"@id":"https:\/\/cloudproinc.com.au\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudproinc.com.au\/#\/schema\/person\/192eeeb0ce91062126ce3822ae88fe6e","name":"CPI Staff","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2d96eeb53b791d92c8c50dd667e3beec92c93253bb6ff21c02cfa8ca73665c70?s=96&d=mm&r=g","caption":"CPI Staff"},"sameAs":["http:\/\/www.cloudproinc.com.au"],"url":"https:\/\/cloudproinc.com.au\/index.php\/author\/cpiadmin\/"}]}},"jetpack_featured_media_url":"\/wp-content\/uploads\/2025\/09\/build-a-chat-bot-with-streamlit-an-end-to-end-guide-for-teams.png","jetpack-related-posts":[{"id":53918,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/22\/securing-streamlit-environment-vars-with-toml\/","url_meta":{"origin":53910,"position":0},"title":"Securing Streamlit Environment Vars with TOML","author":"CPI Staff","date":"September 22, 2025","format":false,"excerpt":"Protect API keys and credentials in Streamlit using TOML-based secrets, safe local and cloud workflows, and CI\/CD patterns for repeatable, secure deployments.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png 1x, \/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png 1.5x, \/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png 2x, \/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png 3x, \/wp-content\/uploads\/2025\/09\/a-practical-guide-to-securing-streamlit-environment-vars-with-toml.png 4x"},"classes":[]},{"id":53902,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/20\/build-data-driven-apps-with-streamlit\/","url_meta":{"origin":53910,"position":1},"title":"Build Data Driven Apps With Streamlit","author":"CPI Staff","date":"September 20, 2025","format":false,"excerpt":"Learn how to build production-ready data apps with Streamlit. From architecture to deployment, practical steps and code to move from notebook to interactive app fast.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png 1x, \/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png 1.5x, \/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png 2x, \/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png 3x, \/wp-content\/uploads\/2025\/09\/build-data-driven-apps-with-streamlit-that-users-love-to-use.png 4x"},"classes":[]},{"id":53573,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/08\/06\/how-to-code-and-build-a-gpt-large-language-model\/","url_meta":{"origin":53910,"position":2},"title":"How to Code and Build a GPT Large Language Model","author":"CPI Staff","date":"August 6, 2025","format":false,"excerpt":"In this blog post, you\u2019ll learn how to code and build a GPT LLM from scratch or fine-tune an existing one. We\u2019ll cover the architecture, key tools, libraries, frameworks, and essential resources to get you started fast. Table of contentsUnderstanding GPT LLM ArchitectureModel Architecture DiagramTools and Libraries to Build a\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/08\/CreateLLM.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/08\/CreateLLM.png 1x, \/wp-content\/uploads\/2025\/08\/CreateLLM.png 1.5x, \/wp-content\/uploads\/2025\/08\/CreateLLM.png 2x, \/wp-content\/uploads\/2025\/08\/CreateLLM.png 3x, \/wp-content\/uploads\/2025\/08\/CreateLLM.png 4x"},"classes":[]},{"id":56899,"url":"https:\/\/cloudproinc.com.au\/index.php\/2026\/01\/29\/3-mistakes-that-quietly-inflate-your-ai-budget\/","url_meta":{"origin":53910,"position":3},"title":"3 Mistakes That Quietly Inflate Your AI Budget","author":"CPI Staff","date":"January 29, 2026","format":false,"excerpt":"AI spend often rises from avoidable design choices. Learn three common mistakes\u2014no caching, unbound context, and the wrong model\u2014and practical steps to reduce costs without hurting quality.","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2026\/01\/post-7.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2026\/01\/post-7.png 1x, \/wp-content\/uploads\/2026\/01\/post-7.png 1.5x, \/wp-content\/uploads\/2026\/01\/post-7.png 2x, \/wp-content\/uploads\/2026\/01\/post-7.png 3x, \/wp-content\/uploads\/2026\/01\/post-7.png 4x"},"classes":[]},{"id":56939,"url":"https:\/\/cloudproinc.com.au\/index.php\/2026\/02\/02\/use-github-copilot-agent-skills-without-blowing-your-context-window\/","url_meta":{"origin":53910,"position":4},"title":"Use GitHub Copilot Agent Skills Without Blowing Your Context Window","author":"CPI Staff","date":"February 2, 2026","format":false,"excerpt":"Learn how GitHub Copilot Agent Skills load the right instructions at the right time, so you can automate repeatable tasks without stuffing every detail into chat history.","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/blog\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2026\/02\/post-4.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2026\/02\/post-4.png 1x, \/wp-content\/uploads\/2026\/02\/post-4.png 1.5x, \/wp-content\/uploads\/2026\/02\/post-4.png 2x, \/wp-content\/uploads\/2026\/02\/post-4.png 3x, \/wp-content\/uploads\/2026\/02\/post-4.png 4x"},"classes":[]},{"id":53958,"url":"https:\/\/cloudproinc.com.au\/index.php\/2025\/09\/25\/document-definition-in-langchain\/","url_meta":{"origin":53910,"position":5},"title":"Document Definition in LangChain","author":"CPI Staff","date":"September 25, 2025","format":false,"excerpt":"Understand LangChain\u2019s Document model and how to structure, chunk, and enrich metadata to build accurate, scalable RAG pipelines.","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png 1x, \/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png 1.5x, \/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png 2x, \/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png 3x, \/wp-content\/uploads\/2025\/09\/mastering-document-definition-in-langchain-for-reliable-rag.png 4x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=53910"}],"version-history":[{"count":2,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53910\/revisions"}],"predecessor-version":[{"id":53913,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/53910\/revisions\/53913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media\/53911"}],"wp:attachment":[{"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=53910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=53910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=53910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}