Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.
Deployments are unavailable in workspaces created on or after November 10, 2026. Workspaces created before that date keep their Deployments.
This quick guide demonstrates how to build and evaluate an AI application for intent classification using the Orq platform.Before you begin, make sure you have an Orq account. If you don’t have one, sign up first. Additionally, we’ve prepared a Google Colab file that you can copy and run immediately, simplifying the setup process. Just replace the API key, and you’re ready to go! After completing this tutorial, visit the Orq documentation for more advanced topics.Why Intent Classification is Useful Intent classification is a powerful tool for understanding and categorizing user inputs, making it essential for building smarter, more responsive applications. Here are a few use cases:
Customer Support: Automatically categorize support tickets or chatbot queries to route them to the right team.
E-commerce Personalization: Understand user intents like “buy,” “browse,” or “compare” to tailor shopping experiences.
Task Automation: Trigger specific workflows based on user commands, such as scheduling meetings or setting reminders.
Step 1: Install Dependencies Start by installing the required packages. These include the Orq SDK and additional libraries for handling datasets and managing environment variables.
Step 2: Identity Tracking (Optional)Identities in Orq.ai help track user interactions and API usage across your application. They can represent users, teams, or projects and enable better analytics and budget management.Create an Identity through the AI Studio:
Step 3: Initialize the Orq Client The Orq client allows you to communicate with the Orq platform. Set it up using your API key, which can be stored as an environment variable (ORQ_API_KEY) or passed directly.
import osfrom orq_ai_sdk import Orqclient = Orq( api_key=os.environ.get("ORQ_API_KEY", "your_orq_api_key"),)# Pass identity per-request: identity={"id": "<identity-id>"} in deployments.invoke() or responses.create()
Step 4: Load a Dataset Use the Hugging Face datasets library to load the dataset for intent classification. Here, we use a public dataset that contains user queries labeled with intents.
from datasets import load_dataset# Load datasetdataset = load_dataset("Bhuvaneshwari/intent_classification")df = dataset["train"].to_pandas()
This deployment is designed to classify user inputs into specific intents to understand the purpose behind their requests. The model will identify the most appropriate intent from a predefined set, enabling precise and context-aware responses.Intent recognition is particularly useful when setting up chatbots.This is the prompt in Orq.ai:
You are tasked with identifying the intent behind user inputs based on the following intents:'PlayMusic', 'AddToPlaylist', 'RateBook', 'Greetings', 'SearchScreeningEvent', 'BookRestaurant', 'GetWeather', 'Book Meeting', 'SearchCreativeWork', 'Cancellation', 'Affirmation', 'excitement'.Here are some examples:Input: "Hey there, how are you doing?"Intent: GreetingsInput: "Play the album Abbey Road by The Beatles."Intent: PlayMusicInput: "Add this song to my workout playlist."Intent: AddToPlaylistInput: "This book deserves a solid five-star rating."Intent: RateBookONLY OUTPUT THE LABEL WITHOUT ''here is the input that needs intent classification: {{text}}
Step 5: Create the Orq Deployment Create a deployment that serves the prompt above.
Open Deployments in the Managed Agents section, then click Deployment.
Set the Deployment Key to intent_classification and select a chat model as the primary model.
Paste the prompt into the Variant’s System message.
The {{text}} variable is filled from the inputs map on each invoke.Step 6: Invoke Orq Deployment Integrate the Orq intent classification model by invoking a deployed model for predictions. Iterate through the dataset and store the results in a new column called “output”.
# Placeholder for deployment keydeployment_key = "intent_classification"# Add predictions to the DataFrameoutputs = []for _, row in df.iterrows(): generation = client.deployments.invoke( key=deployment_key, context={"environments": []}, inputs={"text": row["text"]}, metadata={"custom-field-name": "custom-metadata-value"}, ) outputs.append(generation.choices[0].message.content)# Add the output columndf["output"] = outputs
Step 7: Evaluate Model Performance Use metrics such as accuracy, precision, recall, and F1-score to assess the quality of your model’s predictions.
Feedback Collection (Optional)Feedback in Orq.ai helps track response quality and identify areas for improvement. You can collect user ratings, defect classifications, and corrections to continuously enhance your application.Provide feedback through the AI Studio:
Go to Logs in your workspace
Find the specific deployment invocation
Use the feedback interface to rate responses
Add defect classifications or corrections as needed
Next Steps Congratulations! You’ve successfully built and evaluated an intent classification application using Orq. To further enhance your application:
Explore other datasets and use cases.
Integrate the model into a chatbot or voice assistant.
Automate deployment and testing with Orq’s advanced features.
For more resources, visit the Orq documentation.
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Orq.ai Documentation","description":"Documentation for Orq.ai, the EU-built control plane for enterprise AI: govern every LLM and MCP call with the AI Gateway, and ship backlog work with the Software Factory.","colors":{"primary":"#027f6b","light":"#00d2b5","dark":"#027f6b"},"logo":{"light":"https://mintcdn.com/orqai/OG_14djpK9Yasgfk/images/Orq_ai_Symbol_Dark.svg?fit=max\u0026auto=format\u0026n=OG_14djpK9Yasgfk\u0026q=85\u0026s=d01651850182afdbc6309808b688d470","dark":"https://mintcdn.com/orqai/BYq_L5I_ZDBWL_Pf/images/Orq_ai_Symbol_Light.svg?fit=max\u0026auto=format\u0026n=BYq_L5I_ZDBWL_Pf\u0026q=85\u0026s=3e372f93174202f20c31d2c045af92b9","href":"/ai-gateway/get-started/introduction"},"favicon":"https://mintcdn.com/orqai/rmwcfFw4PPljHRCz/favicon.svg?fit=max\u0026auto=format\u0026n=rmwcfFw4PPljHRCz\u0026q=85\u0026s=1827beca4e1fb46e074d8bda067f3fb1","api":{"openapi":"openapi.json","examples":{"languages":["curl","typescript","python"]}},"background":{"color":{"light":"#f7f6f5","dark":"#171717"}},"navbar":{"links":[],"primary":{"type":"button","label":"Get Started","href":"https://my.orq.ai/auth/signup"}},"footer":{"socials":{"github":"https://github.com/orq-ai","x":"https://x.com/orq_ai","linkedin":"https://www.linkedin.com/company/orqai","website":"https://orq.ai"}},"seo":{"metatags":{"author":"Orq.ai","og:type":"website","og:site_name":"Orq.ai Documentation","og:locale":"en_US","twitter:card":"summary_large_image","twitter:site":"@orq_ai","twitter:creator":"@orq_ai","viewport":"width=device-width, initial-scale=1.0","robots":"index, follow","language":"English"},"organization":{"id":"https://docs.orq.ai/#organization","name":"Orq.ai","legalName":"Orq.AI Holding B.V.","url":"https://orq.ai","logo":"https://docs.orq.ai/images/Orq_ai_Symbol_Dark.svg","sameAs":["https://github.com/orq-ai","https://x.com/orq_ai","https://www.linkedin.com/company/orqai/"]},"indexing":"all"},"fonts":{"heading":{"family":"ES Klarheit Kurrent Semibold","weight":600,"source":"https://framerusercontent.com/assets/HiovZWjG27S5NQhE8dyeECDMc.woff2","format":"woff2"},"body":{"family":"Inter","weight":400,"source":"fonts/inter-latin-400-normal.woff2","format":"woff2"}},"styling":{"codeblocks":{"theme":{"light":"github-light","dark":"github-dark"}},"latex":true},"contextual":{"options":["copy","download-spec","chatgpt","claude","view"],"display":"header"},"interaction":{"drilldown":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"orqai","hasAudioNarration":false,"actualSubdomain":"orqai","customDomains":["docs.orq.ai"],"gitSource":{"type":"github","owner":"orq-ai","repo":"orquesta-web","deployBranch":"main","contentDirectory":"documentation/mintlify","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aec613bada4d37850e27e55","collectionId":"97d33066-b9a1-4280-87e1-bbb0adeceadf","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aec613bada4d37850e27e55"},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aec613bada4d37850e27e55","clientVersion":"0.0.4071","searchFilterCounts":[{"language":"default","tag":"API Reference","count":404},{"language":"default","tag":"Platform APIs","count":258},{"language":"default","tag":"Integrations","count":93},{"language":"default","tag":"Orq SDK","count":70},{"language":"default","tag":"AI Gateway","count":69},{"language":"default","tag":"Management APIs","count":68},{"language":"default","tag":"SDK Reference","count":67},{"language":"default","tag":"Cookbooks","count":34},{"language":"default","tag":"Model Providers","count":31},{"language":"default","tag":"Frameworks \u0026 SDKs","count":30}],"searchSettings":{"maxResults":15}},"assistantConfig":{"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"deflection":{"enabled":true,"email":"support@orq.ai","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":".nav-anchor img{border-radius:50%}.ig-root{scroll-margin-top:6rem}.ig-search{width:100%;padding:10px 14px 10px 38px;border-radius:8px;border:1px solid rgba(0, 0, 0, 0.15);font-size:14px;outline:none;margin-bottom:20px;background:transparent;box-sizing:border-box;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23999' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m21 21-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0Z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:12px center}.dark .ig-search{border-color:rgba(255, 255, 255, 0.15)}.ig-search:focus{border-color:#027f6b}.ig-tabs{display:flex;border-bottom:1px solid rgba(0, 0, 0, 0.1);margin-bottom:20px;gap:0}.dark .ig-tabs{border-bottom-color:rgba(255, 255, 255, 0.1)}.ig-tab{padding:8px 16px;background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer;font-size:14px;font-weight:500;color:#888;white-space:nowrap}.ig-tab:hover{color:#027f6b}.dark .ig-tab:hover{color:#677F78}.ig-tab-active{border-bottom-color:#027f6b!important;color:#027f6b!important}.dark .ig-tab-active{border-bottom-color:#677F78!important;color:#677F78!important}.ig-grid{display:grid;grid-template-columns:repeat(4, 1fr);gap:6px}@media (max-width: 768px){.ig-grid{grid-template-columns:repeat(3, 1fr)}}@media (max-width: 480px){.ig-grid{grid-template-columns:repeat(2, 1fr)}}.ig-card{display:flex;align-items:center;gap:8px;padding:10px 14px;border:1px solid rgba(0, 0, 0, 0.1);border-radius:6px;text-decoration:none!important;color:inherit!important;font-size:14px;font-weight:500;transition:background 0.12s, border-color 0.12s}.ig-card:hover{background:rgba(2, 127, 107, 0.05);border-color:rgba(2, 127, 107, 0.25)}.dark .ig-card{border-color:rgba(255, 255, 255, 0.1)}.dark .ig-card:hover{background:rgba(103, 127, 120, 0.1);border-color:rgba(103, 127, 120, 0.3)}.ig-card-icon{width:20px;height:20px;object-fit:contain;flex-shrink:0}.ig-tab-count{display:inline-flex;align-items:center;justify-content:center;margin-left:6px;padding:0 5px;min-width:18px;height:18px;border-radius:9px;font-size:11px;font-weight:600;background:rgba(0, 0, 0, 0.08);color:inherit}.dark .ig-tab-count{background:rgba(255, 255, 255, 0.12)}.ig-tab-active .ig-tab-count{background:rgba(2, 127, 107, 0.15)}.dark .ig-tab-active .ig-tab-count{background:rgba(103, 127, 120, 0.25)}.ig-empty{text-align:center;padding:48px 24px;color:#999;font-size:14px;grid-column:1 / -1}kbd.key,kbd.key *{color:#fff!important}kbd.key{background:#242424;border-radius:5px;padding:2px 8px;font-size:0.85em;display:inline-flex;align-items:center;gap:6px;border:1px solid #3a3a3a;font-family:inherit;white-space:nowrap}#sidebar-content .flex-1:has(>svg.flex-shrink-0){flex:none!important}#sidebar-content{width:16rem!important;min-width:16rem!important}@media (min-width: 1024px){.lg\\:pl-56{padding-left:16rem!important}}.topbar-right-container nav[aria-label=\"Main\"] .navbar-link a,.topbar-right-container nav[aria-label=\"Main\"] .navbar-link a:hover{background-color:transparent!important}@media (min-width: 1024px){.topbar-right-container nav[aria-label=\"Main\"] ul{gap:1rem!important}.topbar-right-container nav[aria-label=\"Main\"] .navbar-link a{padding-left:0!important;padding-right:0!important}#page-title{font-size:2rem!important;line-height:1.2!important}}.nav-tabs-item:has(a[href^=\"/reference\"]){display:none!important}#navbar .nav-tabs-item[href=\"/ai-studio/integrations/overview\"]{position:relative}#navbar .nav-tabs-item[href=\"/ai-studio/integrations/overview\"]::before{content:'';position:absolute;top:50%;left:-12px;transform:translateY(-50%);height:55%;width:1px;background:rgba(0, 0, 0, 0.15)}.dark #navbar .nav-tabs-item[href=\"/ai-studio/integrations/overview\"]::before{background:rgba(255, 255, 255, 0.15)}@media (min-width: 1280px){#content-container{padding-left:3rem!important;padding-right:2rem!important}#content-side-layout{max-width:20rem!important}#content-area{width:calc(100% - 20rem)!important}}.md-export-list{display:none}@font-face{font-family:'Inter';src:url('/fonts/inter-latin-400-normal.woff2') format('woff2');font-style:normal;font-weight:400;font-display:optional}"}],"page":{"pagePath":"ai-studio/cookbooks/chatbots/intent-classification","slug":"/ai-studio/cookbooks/chatbots/intent-classification","pageMetadata":{"title":"Build an intent classification chatbot","sidebarTitle":"Intent Classification","description":"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.","image":"https://raw.githubusercontent.com/orq-ai/orq-cookbooks/main/Intent%20Classification/IntentClassificationwithOrq.jpg","href":"/ai-studio/cookbooks/chatbots/intent-classification","hidden":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Icon,Info,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Icon)_missingMdxReference(`Icon`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Deployments`}),` are unavailable in workspaces created on or after November 10, 2026. Workspaces created before that date keep their Deployments.`]})}),`\n`,_jsx(_components.p,{children:`This quick guide demonstrates how to build and evaluate an AI application for intent classification using the Orq platform.`}),`\n`,_jsxs(_components.p,{children:[`Before you begin, make sure you have an Orq account. If you don’t have one, `,_jsx(_components.a,{href:`https://orq.ai/create-account`,children:`sign up`}),` first. Additionally, we’ve prepared a `,_jsx(_components.a,{href:`https://colab.research.google.com/drive/1jbb7PKHfvRmqpQhtFMBQqVpHig_nmzZM?usp=sharing`,children:`Google Colab`}),` file that you can copy and run immediately, simplifying the setup process. Just replace the API key, and you’re ready to go! After completing this tutorial, visit the `,_jsx(_components.a,{href:`/ai-studio/ai-engineering/quickstart`,children:`Orq documentation`}),` for more advanced topics.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Why Intent Classification is Useful`}),` Intent classification is a powerful tool for understanding and categorizing user inputs, making it essential for building smarter, more responsive applications. Here are a few use cases:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Customer Support: Automatically categorize support tickets or chatbot queries to route them to the right team.`}),`\n`,_jsx(_components.li,{children:`E-commerce Personalization: Understand user intents like “buy,” “browse,” or “compare” to tailor shopping experiences.`}),`\n`,_jsx(_components.li,{children:`Task Automation: Trigger specific workflows based on user commands, such as scheduling meetings or setting reminders.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 1: Install Dependencies`}),` Start by installing the required packages. These include the Orq SDK and additional libraries for handling datasets and managing environment variables.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Bash`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`!`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`pip`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` install`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` orq-ai-sdk`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` datasets`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` huggingface_hub`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` scikit-learn`})]}),`\n`]})})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Step 2: Identity Tracking (Optional)`})}),`\n`,_jsx(_components.p,{children:`Identities in Orq.ai help track user interactions and API usage across your application. They can represent users, teams, or projects and enable better analytics and budget management.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Create an Identity through the AI Studio:`})}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Go to `,_jsx(_components.strong,{children:`Identity Analytics`}),` in your workspace`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create an Identity`})]}),`\n`,_jsx(_components.li,{children:`Add the user details (name, email, external ID)`}),`\n`,_jsx(_components.li,{children:`Set optional metadata and budget limits`}),`\n`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`To learn more about creating identities, see `,_jsx(_components.a,{href:`/ai-studio/observability/identities#creating-an-identity`,children:`Creating an Identity`}),`.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 3: Initialize the Orq Client`}),` The Orq client allows you to communicate with the Orq platform. Set it up using your API key, which can be stored as an environment variable (ORQ_API_KEY) or passed directly.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` orq_ai_sdk `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` Orq`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`client `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` Orq(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:` api_key`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`os.environ.get(`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"ORQ_API_KEY\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"your_orq_api_key\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Pass identity per-request: identity={\"id\": \"\u003cidentity-id>\"} in deployments.invoke() or responses.create()`})}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 4: Load a Dataset`}),` Use the Hugging Face datasets library to load the dataset for intent classification. Here, we use a public dataset that contains user queries labeled with intents.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` datasets `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` load_dataset`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Load dataset`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`dataset `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` load_dataset(`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Bhuvaneshwari/intent_classification\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`df `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` dataset[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"train\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`].to_pandas()`})]}),`\n`]})})})}),`\n`,_jsx(Heading,{level:`4`,id:`intent-classification-prompt`,children:`Intent classification prompt`}),`\n`,_jsx(_components.p,{children:`This deployment is designed to classify user inputs into specific intents to understand the purpose behind their requests. The model will identify the most appropriate intent from a predefined set, enabling precise and context-aware responses.`}),`\n`,_jsx(_components.p,{children:`Intent recognition is particularly useful when setting up chatbots.`}),`\n`,_jsx(_components.p,{children:`This is the prompt in Orq.ai:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Bash`,numberOfLines:`20`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`You`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` are`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` tasked`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` with`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` identifying`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` the`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` intent`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` behind`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` user`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` inputs`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` based`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` on`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` the`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` following`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` intents:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`'PlayMusic'`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`,`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'AddToPlaylist',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'RateBook',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'Greetings',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'SearchScreeningEvent',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'BookRestaurant',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'GetWeather',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'Book Meeting',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'SearchCreativeWork',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'Cancellation',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'Affirmation',`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` 'excitement'.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Here`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` are`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` some`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` examples:`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` `})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Input:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"Hey there, how are you doing?\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Intent:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` Greetings`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Input:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"Play the album Abbey Road by The Beatles.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Intent:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` PlayMusic`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Input:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"Add this song to my workout playlist.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Intent:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` AddToPlaylist`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Input:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"This book deserves a solid five-star rating.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`Intent:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` RateBook`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`ONLY`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` OUTPUT`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` THE`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` LABEL`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` WITHOUT`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` ''`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`here`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` is`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` the`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` input`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` that`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` needs`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` intent`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` classification:`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` {{text}}`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` `})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 5: Create the Orq Deployment`}),` Create a deployment that serves the prompt above.`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Open `,_jsx(_components.a,{href:`/ai-studio/ai-engineering/deployments`,children:`Deployments`}),` in the `,_jsx(_components.strong,{children:`Managed Agents`}),` section, then click `,_jsxs(`kbd`,{children:[_jsx(Icon,{icon:`plus`}),` Deployment`]}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Set the `,_jsx(_components.strong,{children:`Deployment Key`}),` to `,_jsx(_components.code,{children:`intent_classification`}),` and select a chat model as the primary model.`]}),`\n`,_jsxs(_components.li,{children:[`Paste the prompt into the Variant’s `,_jsx(_components.strong,{children:`System`}),` message.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`{{text}}`}),` variable is filled from the `,_jsx(_components.code,{children:`inputs`}),` map on each invoke.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 6: Invoke Orq Deployment`}),` Integrate the Orq intent classification model by invoking a deployed model for predictions. Iterate through the dataset and store the results in a new column called “output”.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Placeholder for deployment key`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`deployment_key `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"intent_classification\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Add predictions to the DataFrame`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`outputs `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`for`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` _, row `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`in`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` df.iterrows():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` generation `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` client.deployments.invoke(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:` key`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`deployment_key,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:` context`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`{`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"environments\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`: []},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:` inputs`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`{`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`: row[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`]},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:` metadata`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`{`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"custom-field-name\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"custom-metadata-value\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` outputs.append(generation.choices[`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`0`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`].message.content)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Add the output column`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`] `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` outputs`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Step 7: Evaluate Model Performance`}),` Use metrics such as accuracy, precision, recall, and F1-score to assess the quality of your model’s predictions.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,numberOfLines:`13`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` sklearn.metrics `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` accuracy_score, precision_score, recall_score, f1_score`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Calculate metrics`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`accuracy `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` accuracy_score(df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"intent\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`precision `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` precision_score(df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"intent\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], `}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:`average`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"macro\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`recall `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` recall_score(df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"intent\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], `}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:`average`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"macro\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`f1 `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` f1_score(df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"intent\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], df[`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`], `}),_jsx(_components.span,{style:{color:`#E36209`,\"--shiki-dark\":`#FFAB70`},children:`average`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"macro\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`# Display results`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Accuracy: `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`accuracy`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`:.4f`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Precision: `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`precision`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`:.4f`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Recall: `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`recall`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`:.4f`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`print`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`f`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"F1 Score: `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`{`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`f1`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`:.4f`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`}`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`]})})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Feedback Collection (Optional)`})}),`\n`,_jsx(_components.p,{children:`Feedback in Orq.ai helps track response quality and identify areas for improvement. You can collect user ratings, defect classifications, and corrections to continuously enhance your application.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Provide feedback through the AI Studio:`})}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Go to `,_jsx(_components.strong,{children:`Logs`}),` in your workspace`]}),`\n`,_jsx(_components.li,{children:`Find the specific deployment invocation`}),`\n`,_jsx(_components.li,{children:`Use the feedback interface to rate responses`}),`\n`,_jsx(_components.li,{children:`Add defect classifications or corrections as needed`}),`\n`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`You can also `,_jsx(_components.a,{href:`/ai-studio/cookbooks/integrations-tooling/capturing-feedback-with-orq`,children:`collect feedback programmatically via the API`}),` if needed.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Next Steps`}),` Congratulations! You’ve successfully built and evaluated an intent classification application using Orq. To further enhance your application:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Explore other datasets and use cases.`}),`\n`,_jsx(_components.li,{children:`Integrate the model into a chatbot or voice assistant.`}),`\n`,_jsx(_components.li,{children:`Automate deployment and testing with Orq’s advanced features.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`For more resources, visit the Orq documentation.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"github-light","dark":"github-dark"}},"config":{},"pageMetadata":{"title":"Build an intent classification chatbot","sidebarTitle":"Intent Classification","description":"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.","image":"https://raw.githubusercontent.com/orq-ai/orq-cookbooks/main/Intent%20Classification/IntentClassificationwithOrq.jpg","href":"/ai-studio/cookbooks/chatbots/intent-classification","hidden":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Intent classification prompt","slug":"intent-classification-prompt","depth":4,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/orqai/19ee3574279bbaa0/gtm.js","/_mintlify/custom/orqai/1f1a49b99957b631/commonroom-signals.js"],"subdomain":"orqai","siteName":"Orq.ai Documentation","title":"Build an intent classification chatbot - Orq.ai Documentation","contextualStarterQuestions":[{"_id":"6aec43fea5a73d0ef11cb8f7","deploymentId":"68c9bcd7a1b07562da8b036b","questionText":"What packages do I need to install?","status":"active","generatedBy":"contextual","path":"ai-studio/cookbooks/chatbots/intent-classification","createdAt":"2026-11-05T08:53:18.076Z","updatedAt":"2026-11-05T08:53:18.076Z","__v":0},{"_id":"6aec43fea5a73d0ef11cb8f6","deploymentId":"68c9bcd7a1b07562da8b036b","questionText":"How do I classify user intents?","status":"active","generatedBy":"contextual","path":"ai-studio/cookbooks/chatbots/intent-classification","createdAt":"2026-11-05T08:53:18.076Z","updatedAt":"2026-11-05T08:53:18.076Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T08:53:11.775Z","originalFileLocation":"ai-studio/cookbooks/chatbots/intent-classification.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Orq.ai Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"index, follow\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Build an intent classification chatbot - Orq.ai Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Orq.ai Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://orqai.mintlify.app/_mintlify/api/og/v2?division=Chatbots+%26+AI+Apps\u0026amp;title=Build+an+intent+classification+chatbot\u0026amp;description=Build+and+evaluate+an+intent+classification+system+with+Orq.ai.+Categorize+user+queries+for+chatbots%2C+customer+support%2C+and+task+automation+with+Python.\u0026amp;theme=0116d0baa6ba6403f431e631\u0026amp;signature=115d9485c2e3232f737c186fa4a8bfe081fd02e7e60aa2ce838a5aca011c536e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Build an intent classification chatbot - Orq.ai Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://orqai.mintlify.app/_mintlify/api/og/v2?division=Chatbots+%26+AI+Apps\u0026amp;title=Build+an+intent+classification+chatbot\u0026amp;description=Build+and+evaluate+an+intent+classification+system+with+Orq.ai.+Categorize+user+queries+for+chatbots%2C+customer+support%2C+and+task+automation+with+Python.\u0026amp;theme=0116d0baa6ba6403f431e631\u0026amp;signature=115d9485c2e3232f737c186fa4a8bfe081fd02e7e60aa2ce838a5aca011c536e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/orqai/5zquLIiRlftT1q7X/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Orq.ai Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#027f6b\">\u003cmeta data-mint-head name=\"og:locale\" content=\"en_US\">\u003cmeta data-mint-head name=\"author\" content=\"Orq.ai\">\u003cmeta data-mint-head name=\"twitter:creator\" content=\"@orq_ai\">\u003cmeta data-mint-head name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\u003cmeta data-mint-head name=\"language\" content=\"English\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/ai-studio/cookbooks/chatbots/intent-classification.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.orq.ai/#organization\",\"name\":\"Orq.ai\",\"legalName\":\"Orq.AI Holding B.V.\",\"url\":\"https://orq.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://docs.orq.ai/images/Orq_ai_Symbol_Dark.svg\"},\"sameAs\":[\"https://github.com/orq-ai\",\"https://x.com/orq_ai\",\"https://www.linkedin.com/company/orqai/\"]},{\"@type\":\"WebSite\",\"@id\":\"https://docs.orq.ai#website\",\"name\":\"Orq.ai Documentation\",\"url\":\"https://docs.orq.ai\",\"publisher\":{\"@id\":\"https://docs.orq.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification#webpage\",\"url\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification\",\"name\":\"Build an intent classification chatbot\",\"description\":\"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\",\"dateModified\":\"2026-11-05T08:53:11.775Z\",\"isPartOf\":{\"@id\":\"https://docs.orq.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Chatbots \u0026 AI Apps\",\"item\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/maintaining-history-with-a-model\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build an intent classification chatbot\",\"item\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification#article\",\"headline\":\"Build an intent classification chatbot\",\"name\":\"Build an intent classification chatbot\",\"description\":\"Build and evaluate an intent classification system with Orq.ai. Categorize user queries for chatbots, customer support, and task automation with Python.\",\"url\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification\",\"mainEntityOfPage\":{\"@id\":\"https://docs.orq.ai/ai-studio/cookbooks/chatbots/intent-classification#webpage\"},\"dateModified\":\"2026-11-05T08:53:11.775Z\",\"publisher\":{\"@id\":\"https://docs.orq.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.orq.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Orq.ai Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Orq.ai Documentation","nav":{"global":null,"tabs":[{"tab":"AI Gateway","pages":[{"title":"AI Gateway","href":"/ai-gateway/get-started/introduction"}]},{"tab":"AI Observability","pages":[{"title":"AI Observability","href":"/ai-studio/observability/quickstart"}]},{"tab":"Managed agents","pages":[{"title":"Managed agents","href":"/ai-studio/ai-engineering/quickstart"}]},{"tab":"Administration","pages":[{"title":"Administration","href":"/ai-studio/organization/workspace-settings"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/ai-studio/integrations/overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/reference/client-libraries"}]},{"tab":"Cookbooks","hidden":true,"groups":[{"group":"Overview","pages":[{"title":"Cookbooks and tutorials","sidebarTitle":"Cookbooks","description":"Step-by-step tutorials for building AI applications with Orq.ai. Covers RAG chatbots, text-to-SQL, PDF extraction, and multi-agent systems.","mode":"wide","href":"/ai-studio/cookbooks/cookbooks"}]},{"group":"Common Architectures","pages":[{"title":"Simple deployment pattern","sidebarTitle":"Simple Deployment","description":"Implement simple deployment architecture for LLM applications. Quick-start pattern for straightforward AI integration with minimal configuration overhead.","href":"/ai-studio/cookbooks/common-architecture/simple-deployment"},{"title":"Customer support chatbot pattern","sidebarTitle":"Chatbot","description":"Build customer support chatbots with Orq.ai. Create conversational AI with memory, context awareness, and intelligent escalation to human agents.","href":"/ai-studio/cookbooks/common-architecture/chatbot"},{"title":"Simple RAG pattern","sidebarTitle":"Simple RAG","description":"Build a simple RAG system with Orq.ai. Combine knowledge bases with LLMs for accurate, document-grounded responses. Step-by-step implementation guide.","href":"/ai-studio/cookbooks/common-architecture/simple-rag"},{"title":"Advanced RAG with multi-source retrieval","sidebarTitle":"Advanced RAG","description":"Build enterprise RAG systems with multi-source retrieval, agentic query enhancement, and quality validation using Ragas evaluation.","href":"/ai-studio/cookbooks/common-architecture/advanced-rag"},{"title":"AI agent lead qualification pattern","sidebarTitle":"AI Agent","description":"Build multi-agent systems with Orq.ai. Create specialized Agents for lead qualification, CRM integration, and automated workflows through the Responses API.","href":"/ai-studio/cookbooks/common-architecture/ai-agent"},{"title":"Agents Framework \u0026 API Guide","description":"Step-by-step guide to building agents with the Orq.ai Agents Framework and API. Covers tools, memory, knowledge bases, and multi-agent patterns.","href":"/ai-studio/cookbooks/common-architecture/agents-framework-guide"},{"title":"Advisor and Sidekick: second model delegation","sidebarTitle":"Advisor and Sidekick","description":"Run an Agent on a cheap model and pay for a stronger one only at the step that needs it, then read the cost split in the trace.","href":"/ai-studio/cookbooks/common-architecture/advisor-and-sidekick"},{"title":"AI gateway vs config management","sidebarTitle":"AI Gateway vs Configuration Management","description":"Compare AI Gateway and Configuration Management integration patterns. Choose the right Orq.ai architecture for your LLM application deployment strategy.","href":"/ai-studio/cookbooks/common-architecture/gateway-vs-config"}]},{"group":"Chatbots \u0026 AI Apps","pages":[{"title":"Maintain chat history with a model","sidebarTitle":"Chat History","description":"Maintain conversation history with Orq.ai deployments. Build stateful chatbots that remember context across messages with Python and TypeScript examples.","href":"/ai-studio/cookbooks/chatbots/maintaining-history-with-a-model"},{"title":"Build a multilingual FAQ bot with RAG","sidebarTitle":"Multilingual FAQ Bot","description":"Build a multilingual FAQ chatbot with RAG. Use Orq.ai's Routing Engine to serve multiple languages dynamically without hardcoded logic.","href":"/ai-studio/cookbooks/chatbots/multilingual-faq-bot"},{"title":"Build an intent classification chatbot","sidebarTitle":"Intent Classification","href":"/ai-studio/cookbooks/chatbots/intent-classification"},{"title":"Build AI chatbots with Lovable and Orq.ai","sidebarTitle":"Lovable Integration","description":"Build AI chatbots with Lovable and Orq.ai by adding an AGENTS.md snippet, keeping the API key in a Supabase edge function, and grounding answers in a knowledge base.","href":"/ai-studio/cookbooks/chatbots/lovable-integration"},{"title":"Build a multi-agent HR system","sidebarTitle":"Multi-Agent HR System","description":"Build a multi-agent HR system with Python. Create specialized agents for benefits, PTO, and policy questions using memory and knowledge.","href":"/ai-studio/cookbooks/chatbots/agents-API"},{"title":"Compare insurance claims agents built with MCP","sidebarTitle":"Insurance Claims Handling: Multi Agent vs Single Agent Comparison (build via MCP)","description":"Build single-agent and multi-agent insurance claims systems via Orq.ai MCP, then compare them with evaluators and a 15-case dataset.","href":"/ai-studio/cookbooks/chatbots/insurance-claims-mcp-cookbook"},{"title":"Build a customer support chatbot in Node.js","sidebarTitle":"Customer Support Chat","description":"Build a production-ready Node.js customer support chatbot via AI Gateway with streaming, fallbacks, caching, and RAG knowledge base integration.","href":"/ai-studio/cookbooks/chatbots/buildingcustomersupportchatwithaigateway"},{"title":"Transcription and text-to-speech","sidebarTitle":"Speech-to-Text and Text-to-Speech","description":"Compose transcription and text-to-speech around a model call to build a voice-in, voice-out loop.","href":"/ai-studio/cookbooks/chatbots/voice-loop-transcription-and-speech"}]},{"group":"Data \u0026 Extraction","pages":[{"title":"Extract data from PDFs with LLMs","sidebarTitle":"PDF Extraction","description":"Extract structured data from PDF invoices with AI. Transform unstructured documents into actionable JSON using Orq.ai's vision models and deployment features.","href":"/ai-studio/cookbooks/data-extraction/pdf-extraction"},{"title":"Extract data from receipts with OCR","sidebarTitle":"Receipt Extraction","description":"Extract data from receipt images with AI. Process JPG and PNG files to structured JSON with vendor names, amounts, and dates using Orq.ai vision models.","href":"/ai-studio/cookbooks/data-extraction/receipt-extraction"},{"title":"Convert natural language to SQL queries","sidebarTitle":"Text-to-SQL","description":"Transform natural language into SQL queries with AI. Build a text-to-SQL application that lets non-technical users query databases using plain English.","href":"/ai-studio/cookbooks/data-extraction/text-to-sql"}]},{"group":"Evaluation \u0026 Safety","pages":[{"title":"Running evaluations in parallel with Evaluatorq","description":"Run AI experiments from code using Evaluatorq to detect hallucination and measure faithfulness. Compare deployments and agents side-by-side with custom evaluators across any framework.","href":"/ai-studio/cookbooks/evaluation-safety/evaluator-q"},{"title":"Test an Agent with Agent Simulation","sidebarTitle":"Agent Simulation","description":"Put an Agent in front of a simulated user, fix the instructions, replay the same conversations, then generate edge cases the fix was never aimed at.","href":"/ai-studio/cookbooks/evaluation-safety/agent-simulations"},{"title":"Automate evals and observability in Claude Code","description":"Build, run, and analyze evaluations with Claude Code and Orq.ai MCP. Query observability data and automate eval workflows from your terminal.","href":"/ai-studio/cookbooks/evaluation-safety/automate-evals-and-observability-with-claude-code"},{"title":"Align an Evaluator with Human Judgement","sidebarTitle":"Align Evaluators","description":"Find where an LLM-as-a-judge Evaluator disagrees with human reviewers, and rewrite its prompt so its verdicts match.","href":"/ai-studio/cookbooks/evaluation-safety/align-evaluators"},{"title":"Benchmark models head-to-head with Model Arena","sidebarTitle":"Model Arena","description":"Run a real head-to-head model benchmark on real prompts with orq-arena, and read a statistically defensible ranking instead of trusting a public leaderboard.","href":"/ai-studio/cookbooks/evaluation-safety/model-arena"},{"title":"Improve an Agent with Red Teaming","sidebarTitle":"Red Teaming","description":"Attack an Agent with generated attacks, read the finding, fix the instructions, then replay the same attacks to check the leak is closed.","href":"/ai-studio/cookbooks/evaluation-safety/improve-agent-with-red-teaming"}]},{"group":"Integrations \u0026 Tooling","pages":[{"title":"Prompt management tutorial","sidebarTitle":"Prompt Manager","description":"Use Orq.ai as a prompt manager for your LLM calls. Fetch deployment configurations at runtime while keeping control over your infrastructure.","href":"/ai-studio/cookbooks/integrations-tooling/prompt-manager"},{"title":"Capture user feedback on LLM responses","sidebarTitle":"Capturing Feedback","description":"Implement structured user feedback to improve an LLM chatbot. Capture ratings, log defects, and create a continuous learning loop for better AI responses.","href":"/ai-studio/cookbooks/integrations-tooling/capturing-feedback-with-orq"},{"title":"Integrate LangGraph with Orq.ai","sidebarTitle":"LangGraph + Orq.ai","description":"Add Orq.ai to an existing LangGraph agent: route models through the AI Gateway, ground responses with a Knowledge Base, and capture Traces.","href":"/ai-studio/cookbooks/integrations-tooling/integrate-langgraph-with-orq"},{"title":"Chain deployments for multi-step workflows","sidebarTitle":"Chaining Deployments","description":"Chain multiple LLM deployments for complex workflows with evaluators and step-by-step guidance.","href":"/ai-studio/cookbooks/integrations-tooling/chaining-deployments"},{"title":"Use Pinecone and custom vector databases","sidebarTitle":"Third-Party Vector DBs","description":"Connect Pinecone or other vector databases to Orq.ai for custom RAG. Use external embeddings and retrieval while leveraging Orq.ai's Deployment features.","href":"/ai-studio/cookbooks/integrations-tooling/using-thirdparty-vectordbs-with-orq"}]},{"group":"Learn","pages":[{"title":"LLM and AI terminology glossary","sidebarTitle":"LLM Glossary","description":"Complete glossary of LLM, LLMOps, and prompt engineering terms covering 200+ AI concepts.","href":"/ai-studio/cookbooks/learn/llm-glossary"},{"title":"Prompt engineering guide","sidebarTitle":"Prompt Engineering Guide","description":"Master prompt engineering with best practices for LLM optimization and consistent outputs.","href":"/ai-studio/prompts/prompt-engineering-guide"},{"title":"Prompt templating with Jinja and Mustache","sidebarTitle":"Prompt Templating","description":"Reference for Jinja and Mustache template engines in Orq.ai deployments. Covers variables, conditionals, loops, and filters.","href":"/ai-studio/prompts/prompt-templating"}]}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/release-4-17"}]}]},"basePath":"","title":"Build an intent classification chatbot - Orq.ai Documentation","buildId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","deploymentId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","dynamics":[],"chunks":[]}