At Beam, we help people easily run AI apps on cloud GPUs. We have a lively support channel in Slack where we provide world-class™ technical support.We’ve been looking to automate parts of our support workflow. We’ve noticed many of the same questions getting asked over time, and we sometimes find ourselves copying and pasting answers from old threads.In this example, we’re going to build a simple API to take a support question (i.e. “how does your billing work?”) and return a link to a similar Slack message posted in the past.We’re going to use Metal to index our Slack messages and run similarity searches and Beam to run the app as a REST API.
First, we’ll create an index on Metal.Metal has two index types: flat and Hierarchical Navigable Small World (HNSW).Flat uses a simple one-dimensional data structure, and uses nearest neighbors search to find record similarity. In contrast, HNSW works by constructing a hierarchy of different dimensions, which is more efficient and less computationally intensive, at the expense of accuracy.For this example, we’ll be using the Flat dataset. Our dataset is only 100 records, so the performance penalty of the Flat index shouldn’t be an issue.
We’re going to scrape Slack to retrieve all the messages posted in the Channel ID you’ve passed in:
import osfrom slack_sdk import WebClientfrom slack_sdk.errors import SlackApiError# Add your own Slack token and Channel ID to the secrets manager in Beamslack_token = os.environ["SLACK_TOKEN"]channel_id = os.environ["SLACK_CHANNEL_ID"]# Retrieve messages from Slack, using the Channel ID set abovedef scrape_slack(): client = WebClient(slack_token) try: all_messages = [] cursor = None while True: response = client.conversations_history(channel=channel_id, cursor=cursor) all_messages.extend(response["messages"]) cursor = response.get("response_metadata", {}).get("next_cursor") if not cursor: break return all_messages except SlackApiError as e: print(f"Error: {e.response['error']}") return None
After scraping the messages from Slack, we’ll store them in a Metal index.Metal has a method to bulk insert records called index_many(), which is what we’ll use. This method has a limit of 100 records per insertion, so we’re going to limit this to 100 records for now.The text field of each message is what Metal will use to create a similarity index between messages. We’ll also store the user, message type, and ts (timestamp) of the message as metadata.
# Run this manually to scrape slack and index the messages in Metaldef populate_index(): conversation_messages = scrape_slack() messages = [] # Loop through all messages, Metal has a limit of 100 records for message in conversation_messages[:100]: if len(message["text"]) > 3: payload = { "text": message["text"], "index": os.environ["METAL_INDEX_ID"], "metadata": { "user": message["user"], "type": message["type"], "ts": message["ts"], }, } messages.append(payload) # Save messages to Metal, in bulk metal.index_many(messages)if __name__ == "__main__": populate_index()
We’re going to spin up a remote shell on Beam, so that we can run our code in a remote, containerized environment on Beam:
beam start app.py
This command will spin up a cloud container with the beam.App() you’ve specified above, and connect it to your local shell. You’ll know you’re connected to the remote environment when you see a red (beam) next to your cursor:
(beam) python app.py
After running populate_index, we’ll see our indexed Slack messages appear in Metal’s dashboard:
We’re going to deploy this as a REST API, which will take a query (e.g. “how does billing work?”) and return a link to a Slack conversation related to our query.First, we’ll use the metal.search() method to query our index for messages related to our query:
We’re also going to use a Slack method called chat_getPermalink() which will generate a permanent URL to the Slack message returned from our query.And finally, in order to run this as a REST API, we’ll wrap our function in an @app.rest_api() decorator:
Before we expose this as an API, we can run a single search on the cloud, using the beam run command:
beam run app.py:search_conversations -d '{"query": "how does billing work?"}'
We’ll see a response like this in our shell:
(.venv) beta9@MacBook slack-similarity-search % beam run app.py:search_conversations -d \n'{"query": "how does billing work?"}' i Using cached image. App initialized. i Uploading files...Uploading app.py 100% |██████████████████████| (4.8/4.8 kB, 8.3 MB/s) Container scheduled, logs will appear below.Starting app...Loading handler in 'app.py:search_conversations'...Running task: 7e6d55b9-d205-42a1-8b82-f447cca34c5e{'permalink': 'https://beam-89x5025.slack.com/archives/C04AE0PSN2C/p1690078855794459?thread_ts=1690078855.794459&cid=C04AE0PSN2C', 'your_query': 'how does billing work?', 'original_message': 'Hi, I have a question:\n\nHow is billing charged?\n• Is it charged during spinup time where the API is connecting to an available machine. I assume this is latency, and duration is actual runtime correct? So are we charged for latency as well? What determines latency and will there be more machines added in the future?\n'}Task complete: 7e6d55b9-d205-42a1-8b82-f447cca34c5e, duration: 0.3453233242034912s
When we’re ready to deploy, we’ll enter the shell and use the beam deploy command:
beam deploy app.py:search_conversations
When you run this command, your browser window will open the Beam Dashboard. You can copy the cURL or Python request to call the API:After making a request, you’ll see the call appear in your dashboard:You can also click on the Logs tab to view all the container logs:
There’s more work for us to do in operationalizing this code, but it’s a powerful starting point. Metal makes it really easy to store embeddings and search among them. By running this on Beam, we’re able to expose this logic as a serverless REST API using a minimal amount of code and configuration.Feel free to fork this example and extend it as you wish. We look forward to seeing what you build!
Was this page helpful?
⌘I
{"docsConfig":{"theme":"linden","$schema":"https://mintlify.com/docs.json","name":"Beam","description":"Beam provides CPU and GPU machines for agents, billed by the millisecond: persistent VMs that pause with their memory intact, sandboxes that boot in seconds, and GPU endpoints for inference.","colors":{"primary":"#477ff7","light":"#93c5fd","dark":"#2563eb"},"logo":{"light":"https://mintcdn.com/slai-beam/StmwwthCMFzpzgft/logo/dark-logo.svg?fit=max\u0026auto=format\u0026n=StmwwthCMFzpzgft\u0026q=85\u0026s=23387d001289bc6dcbe6be3f49769690","dark":"https://mintcdn.com/slai-beam/StmwwthCMFzpzgft/logo/light-logo.svg?fit=max\u0026auto=format\u0026n=StmwwthCMFzpzgft\u0026q=85\u0026s=0e0baef0b1593f56b60113ffd67fd744"},"favicon":"https://mintcdn.com/slai-beam/ZujHWu-L9dNBQS2M/logo/favicon.png?fit=max\u0026auto=format\u0026n=ZujHWu-L9dNBQS2M\u0026q=85\u0026s=b6614f50c2766c80749cc429d96a3a05","navbar":{"links":[{"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA","label":"Community"},{"href":"https://status.beam.cloud","label":"Status"}],"primary":{"type":"button","label":"Dashboard","href":"https://platform.beam.cloud"}},"footer":{"socials":{"website":"https://beam.cloud","github":"https://github.com/beam-cloud/beta9","slack":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"}},"seo":{"metatags":{"og:image":"https://www.beam.cloud/meta-hero.png"},"indexing":"navigable"},"fonts":{"family":"Inter"},"integrations":{"ga4":{"measurementId":"G-XN1SS41L9X"},"posthog":{"apiKey":"phc_VhYc3jzbsDBBGtZHU3fLefqRq6wE8FxZLy1zJk1cLeB","apiHost":"https://us.i.posthog.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["Install the Beam CLI, sign in, and connect coding agents to the Beam MCP server with `curl -fsSL https://www.beam.cloud/install | sh`. To also create a VM, run `curl -fsSL https://www.beam.cloud/install | sh -s -- --vm`.","VMs are persistent Linux machines without GPUs. Defaults: 4 CPUs, 8 GiB of RAM, a 50 GiB disk, Ubuntu 24.04, and a browser desktop. A running VM accrues usage until you stop, pause, or remove it, or until an idle timeout puts it to sleep.","Stopping a VM keeps its disk and discards RAM and processes. Pausing keeps both, and resuming restores them. To pause after 5 idle minutes and wake on access, run `beam vm update NAME --ttl 300 --idle-action pause --auto-resume`.","Core VM commands: `beam vm new NAME`, `beam vm ssh NAME`, `beam vm sync NAME ./dir`, `beam vm exec NAME -- CMD`, `beam vm expose NAME PORT --protected`, `beam vm fork NAME NEW_NAME`, `beam vm pause NAME`, `beam vm stop NAME`, `beam vm rm NAME`.","For GPUs, use a sandbox or a deployed endpoint. Sandboxes are disposable environments that boot in seconds and fork from snapshots.","Current rates are at https://www.beam.cloud/pricing."]},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Slack Community","icon":"slack","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"},{"anchor":"Github","icon":"github","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://github.com/beam-cloud/beta9"},{"anchor":"Twitter","icon":"twitter","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://twitter.com/beam_cloud"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"slai-beam","hasAudioNarration":false,"actualSubdomain":"slai-beam","customDomains":["docs.beam.cloud"],"gitSource":{"type":"github","owner":"slai-labs","repo":"beam-docs","deployBranch":"main","contentDirectory":"","mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aebc6eaa34c0c6c22ffe281","collectionId":"22558a90-79b7-4e38-898e-be1fda776528","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aebc6eaa34c0c6c22ffe281"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6aebc6eaa34c0c6c22ffe281","clientVersion":"0.0.4067","searchFilterCounts":[{"language":"default","tag":"Documentation","count":83},{"language":"default","tag":"Examples","count":16},{"language":"default","tag":"Building Blocks","count":12},{"language":"default","tag":"Inference","count":11},{"language":"default","tag":"Virtual Machines","count":11},{"language":"default","tag":"Advanced Topics","count":9},{"language":"default","tag":"Start Here","count":9},{"language":"default","tag":"API Reference","count":7},{"language":"default","tag":"Sandboxes","count":7},{"language":"default","tag":"Data and Storage","count":5}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@beam.cloud"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"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":"style.css","content":"#navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a{padding:0.375rem 0.75rem;border-radius:9999px;background-color:rgb(243 244 246);color:rgb(17 24 39);font-size:0.875rem;line-height:1.25rem;transition:background-color 150ms ease}#navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a:hover{background-color:rgb(229 231 235);color:rgb(17 24 39)}.dark #navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a{background-color:rgb(255 255 255 / 0.08);color:rgb(255 255 255)}.dark #navbar ul:has(>#topbar-cta-button)>li:not(#topbar-cta-button)>a:hover{background-color:rgb(255 255 255 / 0.14);color:rgb(255 255 255)}#topbar-cta-button>a{padding:0.375rem 0.875rem;border-radius:9999px;border-color:transparent;background-color:#477ff7;color:#ffffff;transition:background-color 150ms ease}#topbar-cta-button>a:hover{background-color:#2563eb;color:#ffffff}#topbar-cta-button>a svg{display:none}"}],"page":{"pagePath":"examples/slack-support","slug":"/examples/slack-support","pageMetadata":{"title":"Search Slack Messages","description":"An example app that searches your Slack messages to answer technical questions.","icon":"slack","href":"/examples/slack-support"},"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: \"An example app that searches your Slack messages to answer technical questions.\"\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`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`slack-similarity-search-powered-by-metal`,children:`Slack Similarity Search, Powered by Metal`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=5ba580f5fc24aa179d6f3f6bb737a7f0`,alt:``,\"data-og-width\":`1200`,width:`1200`,\"data-og-height\":`630`,height:`630`,\"data-path\":`img/examples/slack/hero.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=33437db0b7e945dd6a72a014aaa255e3 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=36b10cde6aece266d6e0c022e7c3e1ea 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=20395608050466602226ea05bd42d457 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=eced302221d3779ee1624c79b2b977df 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=3de5af44cf88976b0e8486c1b3a90169 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/hero.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=d59ed84059dc02d51939df8e25bff4bb 2500w`}),`\n`,_jsxs(_components.p,{children:[`At Beam, we help people easily run AI apps on cloud GPUs. We have a `,_jsx(_components.a,{href:`https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA`,children:`lively support channel in Slack`}),` where we provide world-class™ technical support.`]}),`\n`,_jsx(_components.p,{children:`We’ve been looking to automate parts of our support workflow. We’ve noticed many of the same questions getting asked over time, and we sometimes find ourselves copying and pasting answers from old threads.`}),`\n`,_jsx(_components.p,{children:`In this example, we’re going to build a simple API to take a support question (i.e. “how does your billing work?”) and return a link to a similar Slack message posted in the past.`}),`\n`,_jsxs(_components.p,{children:[`We’re going to use `,_jsx(_components.a,{href:`https://getmetal.io`,children:`Metal`}),` to index our Slack messages and run similarity searches and `,_jsx(_components.a,{href:`https://beam.cloud`,children:`Beam`}),` to run the app as a REST API.`]}),`\n`,_jsx(`div`,{class:`container`,style:{},children:_jsx(`form`,{action:`https://github.com/slai-labs/get-beam/tree/main/examples/slack-similarity-search`,method:`get`,target:`_blank`,children:_jsx(`button`,{class:`button`,type:`submit`,style:{margin:`auto`,width:250,borderRadius:5,color:`rgb(237, 238, 240)`,backgroundColor:`rgb(71, 127, 247)`,fontWeight:`bold`,boxShadow:`0 0 3px 2px #cec7c759`},children:_jsx(_components.p,{children:`Try this example on Github`})})})}),`\n`,_jsx(Heading,{level:`2`,id:`pre-requisites`,children:`Pre-requisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Metal Account`}),`. It’s free to get started, and you can `,_jsx(_components.a,{href:`https://getmetal.io`,children:`signup here`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Slack Bot Token`}),`. Learn more about generating an access token `,_jsx(_components.a,{href:`https://api.slack.com/tutorials/tracks/getting-a-token`,children:`here`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Slack Channel ID`}),`. You can find the channel ID by clicking your channel name in Slack —> `,_jsx(_components.code,{children:`About`}),` —> `,_jsx(_components.em,{children:`Copy the channel ID`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`add-secrets`,children:`Add Secrets`}),`\n`,_jsx(_components.p,{children:`You’ll need to add the following secrets to the Beam Secret Manager:`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Metal`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`METAL_API_KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`METAL_CLIENT_ID`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`METAL_INDEX_ID`})}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Slack`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`SLACK_CHANNEL_ID`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`SLACK_TOKEN`})}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=0443a830a1d667450cb4cc66a6b7fc8e`,alt:``,\"data-og-width\":`1236`,width:`1236`,\"data-og-height\":`545`,height:`545`,\"data-path\":`img/examples/slack/secret-list.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=b6bff59a7f5ab13a75705b137054a233 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=6f1f2361618acdba9164e0e059c51b48 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=524bbe6d1fd73919573b614ff515fbb2 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=4a73b0351093673cd6d86a39cbd72d64 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=39d73344a4923124794dd3b9908b4a1d 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/secret-list.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=838438c328b06169299c91bf9bc40afc 2500w`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=6e5d518ee19c43248b5b72ac00397820`,alt:``,\"data-og-width\":`1227`,width:`1227`,\"data-og-height\":`731`,height:`731`,\"data-path\":`img/examples/slack/create-secret.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=7362a16e40de672637366d2ee2d18912 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=a895d787edab76725f03ec2ee2c2eff9 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=367b63668a0c8b91208f5d2b9b53d230 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=c81264b0f06e519a84f982b3a8275064 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=51f5a161d2684283522e38a7a194e788 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/create-secret.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=84d626ad601e02d19c04ba08ae1e6ce3 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`setup-metal`,children:`Setup Metal`}),`\n`,_jsx(_components.p,{children:`First, we’ll create an index on Metal.`}),`\n`,_jsxs(_components.p,{children:[`Metal has two index types: `,_jsx(_components.strong,{children:`flat`}),` and `,_jsx(_components.strong,{children:`Hierarchical Navigable Small World (HNSW)`}),`.`]}),`\n`,_jsx(_components.p,{children:`Flat uses a simple one-dimensional data structure, and uses nearest neighbors search to find record similarity. In contrast, HNSW works by constructing a hierarchy of different dimensions, which is more efficient and less computationally intensive, at the expense of accuracy.`}),`\n`,_jsx(_components.p,{children:`For this example, we’ll be using the Flat dataset. Our dataset is only 100 records, so the performance penalty of the Flat index shouldn’t be an issue.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=8c6ddf015ec78cb607ce0615ac0d563a`,alt:``,\"data-og-width\":`2558`,width:`2558`,\"data-og-height\":`2300`,height:`2300`,\"data-path\":`img/examples/slack/metal-index.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=ea2db83449e2e687f4358a62d079e5d6 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=a36f02170f101d1b121210080e4c73df 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=ec14473ac014d7fac836079c287ac7a8 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=2365b40bb064776660a55ec9aad8cfb8 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=98e96337ea5730367649f83de9c4875a 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-index.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=e81c78ef16632c8c030a2310f6a4b40d 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`setup-beam`,children:`Setup Beam`}),`\n`,_jsxs(_components.p,{children:[`Next, we’ll setup a Beam `,_jsx(_components.code,{children:`Runtime`}),` with the remote compute options for the app, and a Beam `,_jsx(_components.code,{children:`Image`}),` with the Python packages we’ll need to run our code:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` beam `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` App, Runtime, Image`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` App(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"slack-similarity-search\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` runtime`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Runtime(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` cpu`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` memory`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"8Gi\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` image`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Image(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` python_packages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"metal_sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"slack-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`scrape-slack`,children:`Scrape Slack`}),`\n`,_jsxs(_components.p,{children:[`We’re going to scrape Slack to retrieve all the messages posted in the `,_jsx(_components.code,{children:`Channel ID`}),` you’ve passed in:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`31`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`31`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` slack_sdk `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` WebClient`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` slack_sdk.errors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SlackApiError`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Add your own Slack token and Channel ID to the secrets manager in Beam`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`slack_token `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SLACK_TOKEN\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`channel_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SLACK_CHANNEL_ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Retrieve messages from Slack, using the Channel ID set above`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` scrape_slack`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` WebClient(slack_token)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` all_messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cursor `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` while`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.conversations_history(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`channel`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`channel_id, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cursor`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`cursor)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` all_messages.extend(response[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cursor `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response_metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {}).get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"next_cursor\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cursor:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` all_messages`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` except`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SlackApiError `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Error: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`e.response[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'error'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`index-scraped-messages-in-metal`,children:`Index Scraped Messages in Metal`}),`\n`,_jsx(_components.p,{children:`After scraping the messages from Slack, we’ll store them in a Metal index.`}),`\n`,_jsxs(_components.p,{children:[`Metal has a method to bulk insert records called `,_jsx(_components.code,{children:`index_many()`}),`, which is what we’ll use. This method has a limit of 100 records per insertion, so we’re going to limit this to 100 records for now.`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`text`}),` field of each message is what Metal will use to create a similarity index between messages. We’ll also store the `,_jsx(_components.code,{children:`user`}),`, message `,_jsx(_components.code,{children:`type`}),`, and `,_jsx(_components.code,{children:`ts`}),` (timestamp) of the message as metadata.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`24`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`24`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Run this manually to scrape slack and index the messages in Metal`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` populate_index`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` conversation_messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` scrape_slack()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Loop through all messages, Metal has a limit of 100 records`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` conversation_messages[:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(message[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"index\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"METAL_INDEX_ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages.append(payload)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Save messages to Metal, in bulk`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` metal.index_many(messages)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` __name__`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"__main__\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` populate_index()`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`run-on-beam`,children:`Run on Beam`}),`\n`,_jsx(_components.p,{children:`We’re going to spin up a remote shell on Beam, so that we can run our code in a remote, containerized environment on Beam:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` start`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This command will spin up a cloud container with the `,_jsx(_components.code,{children:`beam.App()`}),` you’ve specified above, and connect it to your local shell. You’ll know you’re connected to the remote environment when you see a red `,_jsx(_components.code,{children:`(beam)`}),` next to your cursor:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`After running `,_jsx(_components.code,{children:`populate_index`}),`, we’ll see our indexed Slack messages appear in Metal’s dashboard:`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=585b92b292aef6b603b07c051fde5019`,alt:``,\"data-og-width\":`2716`,width:`2716`,\"data-og-height\":`1170`,height:`1170`,\"data-path\":`img/examples/slack/metal-records.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=bac1119605d782f02877af03e15f2c20 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=e12236ec1d74d2b49f05632421d05d18 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=eec76a846d1c43b755e8a091d0ca05b8 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=511d7584612de1489fea1fa343221688 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=51d3a5ce91e57a603ef743f52ff55762 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metal-records.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=598f5f0e5a383229c477cde2e51d333c 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`deploy-rest-api`,children:`Deploy REST API`}),`\n`,_jsx(_components.p,{children:`We’re going to deploy this as a REST API, which will take a query (e.g. “how does billing work?”) and return a link to a Slack conversation related to our query.`}),`\n`,_jsxs(_components.p,{children:[`First, we’ll use the `,_jsx(_components.code,{children:`metal.search()`}),` method to query our index for messages related to our query:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`metal.search(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: query},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` index_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"METAL_INDEX_ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` limit`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`We’re also going to use a Slack method called `,_jsx(_components.code,{children:`chat_getPermalink()`}),` which will generate a permanent URL to the Slack message returned from our query.`]}),`\n`,_jsxs(_components.p,{children:[`And finally, in order to run this as a REST API, we’ll wrap our function in an `,_jsx(_components.code,{children:`@app.rest_api()`}),` decorator:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`26`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`26`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@app.rest_api`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` search_conversations`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`inputs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` query `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inputs[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` metal_response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` metal.search(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: query},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` index_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"METAL_INDEX_ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` limit`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(metal_response.content)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Get permalink to the relevant Slack conversation`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` WebClient(slack_token)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` permalink `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat_getPermalink(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` channel`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`channel_id, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`message_ts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"permalink\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: permalink[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"permalink\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your_query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: query,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"original_message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: response[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(payload)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"results\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: payload}`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Before we expose this as an API, we can run a single search on the cloud, using the `,_jsx(_components.code,{children:`beam run`}),` command:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`beam run app.py:search_conversations -d '{\"query\": \"how does billing work?\"}'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`We’ll see a response like this in our shell:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`.venv`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beta9@MacBook`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` slack-similarity-search`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` %`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py:search_conversations`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\n`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`'{\"query\": \"how does billing work?\"}'`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` i`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Using`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cached`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` image.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` App`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` initialized.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` i`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Uploading`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` files...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Uploading`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 100%`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`██████████████████████`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`4.8/4.8`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` kB,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8.3`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` MB/s`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` Container`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` scheduled,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` logs`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` will`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` appear`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` below.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Starting`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Loading`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` handler`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` in`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'app.py:search_conversations'...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Running`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` task:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 7e6d55b9-d205-42a1-8b82-f447cca34c5e`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`'permalink'`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://beam-89x5025.slack.com/archives/C04AE0PSN2C/p1690078855794459?thread_ts=1690078855.794459\u0026cid=C04AE0PSN2C',`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'your_query':`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'how does billing work?',`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'original_message':`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hi, I have a question:\\\\n\\\\nHow is billing charged?\\\\n• Is it charged during spinup time where the API is connecting to an available machine. I assume this is latency, and duration is actual runtime correct? So are we charged for latency as well? What determines latency and will there be more machines added in the future?\\\\n'}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Task`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` complete:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 7e6d55b9-d205-42a1-8b82-f447cca34c5e,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` duration:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 0.3453233242034912s`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`When we’re ready to deploy, we’ll enter the shell and use the `,_jsx(_components.code,{children:`beam deploy`}),` command:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`beam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` deploy`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py:search_conversations`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`When you run this command, your browser window will open the Beam Dashboard. You can copy the cURL or Python request to call the API:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=3731322b6a72248862a8fa50e064dab2`,alt:``,\"data-og-width\":`1265`,width:`1265`,\"data-og-height\":`845`,height:`845`,\"data-path\":`img/examples/slack/call-api.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=779c2275d6e01eb2193c9a97555224c1 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=d114ec6ff42ef0fbacef5cd03032aa63 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=fa60181309867fe9f7a96e004ee77d1a 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=a28aa79a3038cc2d6ebfbdd8f4e5fb5d 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=2118072456f3ff4954d8c03a7e2175f5 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/call-api.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=3bacd3a40b05cb582aa3219246d57925 2500w`}),`\n`,_jsx(_components.p,{children:`After making a request, you’ll see the call appear in your dashboard:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=2a5c1f458a87eec07f6126c0a03afd77`,alt:``,\"data-og-width\":`1268`,width:`1268`,\"data-og-height\":`609`,height:`609`,\"data-path\":`img/examples/slack/metrics.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=f4ff3ee65aebbefb173aef2dc403cebc 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=c28057f27065a65e464f6781800ce52f 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=81f4ff447b666fd73c3da9cbdab98929 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=c85618c5479419c7cf6cfba69dbfbe39 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=c2208faab50e5e77fe0a5ad66c4cf09d 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/metrics.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=500d4cb8f048941a7b97b53a91a49cc2 2500w`}),`\n`,_jsxs(_components.p,{children:[`You can also click on the `,_jsx(_components.em,{children:`Logs`}),` tab to view all the container logs:`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=d717f3519447183d42621396eed45fef`,alt:``,\"data-og-width\":`1263`,width:`1263`,\"data-og-height\":`609`,height:`609`,\"data-path\":`img/examples/slack/logs.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=280\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=eb3484b4eb2381a9d08f4cc15c9ac8e1 280w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=560\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=5d53b64a24506abd6f2f6f92a33ee802 560w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=840\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=62ad95496f84a4cfbd1b1f8d2e2004ed 840w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=1100\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=6f19a1690fe91bdb5bee4cf6cade9bd7 1100w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=1650\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=487e0b5649f5952ff62c86471e7aace4 1650w, https://mintcdn.com/slai-beam/cYxAFgZcnH6nQdWb/img/examples/slack/logs.png?w=2500\u0026fit=max\u0026auto=format\u0026n=cYxAFgZcnH6nQdWb\u0026q=85\u0026s=88774c39f45aae69f0fbcc9c50f1a5a8 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`conclusion`,children:`Conclusion`}),`\n`,_jsx(_components.p,{children:`There’s more work for us to do in operationalizing this code, but it’s a powerful starting point. Metal makes it really easy to store embeddings and search among them. By running this on Beam, we’re able to expose this logic as a serverless REST API using a minimal amount of code and configuration.`}),`\n`,_jsx(_components.p,{children:`Feel free to fork this example and extend it as you wish. We look forward to seeing what you build!`})]})}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":{"config":{},"pageMetadata":{"title":"Search Slack Messages","description":"An example app that searches your Slack messages to answer technical questions.","icon":"slack","href":"/examples/slack-support"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Slack Similarity Search, Powered by Metal","slug":"slack-similarity-search-powered-by-metal","depth":1,"children":[]},{"title":"Pre-requisites","slug":"pre-requisites","depth":2,"children":[]},{"title":"Add Secrets","slug":"add-secrets","depth":2,"children":[]},{"title":"Setup Metal","slug":"setup-metal","depth":2,"children":[]},{"title":"Setup Beam","slug":"setup-beam","depth":2,"children":[]},{"title":"Scrape Slack","slug":"scrape-slack","depth":2,"children":[]},{"title":"Index Scraped Messages in Metal","slug":"index-scraped-messages-in-metal","depth":2,"children":[]},{"title":"Run on Beam","slug":"run-on-beam","depth":2,"children":[]},{"title":"Deploy REST API","slug":"deploy-rest-api","depth":2,"children":[]},{"title":"Conclusion","slug":"conclusion","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"slai-beam","siteName":"Beam","title":"Search Slack Messages - Beam","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-29T19:57:27.171Z","originalFileLocation":"examples/slack-support.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=\"An example app that searches your Slack messages to answer technical questions.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Beam\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_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/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Search Slack Messages - Beam\">\u003cmeta data-mint-head property=\"og:description\" content=\"An example app that searches your Slack messages to answer technical questions.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Beam\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.beam.cloud/examples/slack-support\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://www.beam.cloud/meta-hero.png\">\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=\"Search Slack Messages - Beam\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"An example app that searches your Slack messages to answer technical questions.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://www.beam.cloud/meta-hero.png\">\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/slai-beam/vbRSBpVzlMVt02hX/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Beam\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#477ff7\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.beam.cloud/examples/slack-support\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/examples/slack-support.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Beam\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Beam","nav":{"global":{"anchors":[{"anchor":"Slack Community","icon":"slack","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://join.slack.com/t/beam-cloud/shared_invite/zt-4bf7jalhy-KI0ebGXk4vKpcDofwDjCLA"},{"anchor":"Github","icon":"github","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://github.com/beam-cloud/beta9"},{"anchor":"Twitter","icon":"twitter","color":{"light":"#6365f1","dark":"#6365f1"},"href":"https://twitter.com/beam_cloud"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Start Here","pages":[{"title":"Introduction","icon":"table-rows","href":"/v2/getting-started/introduction"},{"title":"Give an Agent a Dev Box","sidebarTitle":"Virtual Machines","icon":"server","href":"/v2/getting-started/quickstart-vm"},{"title":"Run Agent Code in a Sandbox","sidebarTitle":"Sandboxes","icon":"box","href":"/v2/getting-started/quickstart-sandbox"},{"title":"Quickstart: Deploy an Endpoint","sidebarTitle":"Endpoints","icon":"hand-wave","href":"/v2/getting-started/quickstart"},{"title":"Set Up Coding Agents","icon":"plug","href":"/v2/getting-started/add-to-cursor-claude"},{"title":"Installation","icon":"download","href":"/v2/getting-started/installation"},{"title":"Authentication and Workspaces","icon":"key","href":"/v2/getting-started/authentication"},{"title":"Core Concepts","icon":"notebook","href":"/v2/getting-started/core-concepts"},{"title":"Using the Dashboard","icon":"browser","href":"/v2/getting-started/dashboard"}]},{"group":"Virtual Machines","pages":[{"title":"Overview","icon":"server","href":"/v2/vm/overview"},{"title":"Configuration","icon":"sliders","href":"/v2/vm/configuration"},{"title":"Secrets","icon":"lock","href":"/v2/vm/secrets"},{"title":"Lifecycle","icon":"power-off","href":"/v2/vm/lifecycle"},{"title":"Storage and Snapshots","icon":"database","href":"/v2/vm/storage"},{"title":"Commands and SSH","icon":"terminal","href":"/v2/vm/processes"},{"title":"Networking","icon":"network-wired","href":"/v2/vm/networking"},{"title":"Desktop","icon":"desktop","href":"/v2/vm/desktop"},{"title":"Docker and Compose","icon":"docker","href":"/v2/vm/docker"},{"title":"CLI Reference","icon":"code","href":"/v2/vm/cli"},{"title":"SDK","icon":"code","href":"/v2/vm/sdk"}]},{"group":"Sandboxes","pages":[{"title":"Overview","icon":"box","href":"/v2/sandbox/overview"},{"title":"Sandbox Configuration","icon":"wrench","href":"/v2/sandbox/configuration"},{"title":"Snapshots","icon":"camera","href":"/v2/sandbox/snapshots"},{"title":"Process Management","icon":"terminal","href":"/v2/sandbox/processes"},{"title":"Networking","icon":"globe","href":"/v2/sandbox/networking"},{"title":"File System Operations","icon":"folder","href":"/v2/sandbox/filesystem"},{"title":"Docker in Sandboxes","icon":"docker","href":"/v2/sandbox/docker"}]},{"group":"Inference","pages":[{"title":"Hosted Model Inference","icon":"brain","href":"/v2/endpoint/hosted-models"},{"title":"Creating a Web Endpoint","icon":"laptop-code","href":"/v2/endpoint/overview"},{"title":"Hosting a Web Server","icon":"server","href":"/v2/endpoint/web-server"},{"title":"Realtime and Streaming","icon":"bolt","href":"/v2/endpoint/realtime"},{"title":"Pre-Loading Models","icon":"circle-down","href":"/v2/endpoint/loaders"},{"title":"Cold Start Performance","icon":"rocket","href":"/v2/topics/cold-start"},{"title":"Keeping Containers Warm","icon":"hotjar","href":"/v2/endpoint/keep-warm"},{"title":"Concurrent Inputs","icon":"cubes-stacked","href":"/v2/scaling/concurrent-inputs"},{"title":"GPU Acceleration","icon":"microchip","href":"/v2/environment/gpu"},{"title":"Versioning","icon":"code-compare","href":"/v2/endpoint/versioning"},{"title":"Sending File Payloads","icon":"file","href":"/v2/endpoint/sending-file-payloads"}]},{"group":"Building Blocks","pages":[{"title":"Running Async Tasks","icon":"layer-group","href":"/v2/task-queue/running-tasks"},{"title":"Querying Task Status","icon":"check-double","href":"/v2/task-queue/query-status"},{"title":"Running Functions Remotely","icon":"cloud","href":"/v2/function/running-functions"},{"title":"Scheduled Jobs","icon":"clock","href":"/v2/function/scheduled-job"},{"title":"Queues","icon":"grip-lines","href":"/v2/function/queues"},{"title":"Distributed Maps","icon":"book","href":"/v2/function/maps"},{"title":"Deploy Containers","icon":"docker","href":"/v2/hosting/containers"},{"title":"Deployment Lifecycle","icon":"code-branch","href":"/v2/hosting/deployments"},{"title":"Environment Variables and References","icon":"link","href":"/v2/hosting/references"},{"title":"Stacks","icon":"layer-group","href":"/v2/hosting/stacks"},{"title":"Host a Web Service","icon":"hammer","href":"/v2/pod/web-service"},{"title":"Networking","icon":"sitemap","href":"/v2/pod/networking"}]},{"group":"Container Images","pages":[{"title":"Container Images","icon":"gears","href":"/v2/environment/custom-images"},{"title":"Custom Registries","icon":"list","href":"/v2/environment/custom-registries"},{"title":"CPU and RAM","icon":"server","href":"/v2/environment/resources"},{"title":"Storing Secrets","icon":"lock","href":"/v2/environment/secrets"}]},{"group":"Data and Storage","pages":[{"title":"Managed Databases","icon":"database","href":"/v2/data/databases"},{"title":"Distributed Storage Volumes","icon":"hard-drive","href":"/v2/data/volume"},{"title":"Durable Disks","icon":"database","href":"/v2/data/durable-disks"},{"title":"Mounting S3 Buckets","icon":"bucket","href":"/v2/data/external-storage"},{"title":"Ephemeral Files and Images","icon":"upload","href":"/v2/data/output"}]},{"group":"Scaling","pages":[{"title":"Scaling Out","icon":"boxes-stacked","href":"/v2/scaling/concurrency"},{"title":"Parallelizing Functions","icon":"boxes-stacked","href":"/v2/scaling/parallelizing-functions"}]},{"group":"Operations","pages":[{"title":"Logs and Metrics","icon":"chart-line","href":"/v2/operations/observability"},{"title":"Workspace MCP","icon":"plug","href":"/v2/operations/mcp"},{"title":"Webhooks","icon":"webhook","href":"/v2/operations/webhooks"}]},{"group":"Run in Your Cloud","pages":[{"title":"Compute Pools","icon":"server","href":"/v2/scaling/pools"},{"title":"Overview","icon":"building","href":"/v2/self-hosting/overview"},{"title":"Local Development Cluster","icon":"computer","href":"/v2/self-hosting/local-machine"},{"title":"Deploying Beta9 on AWS","icon":"aws","href":"/v2/self-hosting/aws"}]},{"group":"Advanced Topics","pages":[{"title":"Integrate into CI/CD","icon":"link","href":"/v2/topics/ci"},{"title":"Input and Output Schemas","icon":"brackets-curly","href":"/v2/topics/schemas"},{"title":"Timeouts and Retries","icon":"clock","href":"/v2/topics/timeouts-and-retries"},{"title":"Public Endpoints","icon":"unlock","href":"/v2/topics/public-endpoints"},{"title":"Task Callbacks","icon":"bell","href":"/v2/topics/callbacks"},{"title":"Send Events Between Apps","icon":"circle","href":"/v2/topics/signal"},{"title":"Runtime Variables","icon":"code","href":"/v2/topics/context"},{"title":"Working in Jupyter Notebooks","icon":"book","href":"/v2/environment/jupyter-notebook"},{"title":"Remote vs. Local Environment","icon":"house","href":"/v2/environment/remote-versus-local"}]},{"group":"Resources","pages":[{"title":"Pricing and Billing","icon":"dollar-sign","href":"/v2/resources/pricing-and-billing"},{"title":"Using Beam Docs with AI Tools","icon":"robot","href":"/v2/resources/ai-tools"},{"title":"Troubleshooting","icon":"question","href":"/v2/resources/faq"}]},{"group":"Security","pages":[{"title":"Security overview","icon":"shield-halved","href":"/v2/security/security"},{"title":"Terms of Service","icon":"handshake","href":"/v2/security/terms-and-conditions"},{"title":"Privacy Policy","icon":"user-secret","href":"/v2/security/privacy-policy"},{"title":"Data Processing Addendum","icon":"file-shield","hidden":true,"href":"/v2/security/data-processing-addendum"},{"title":"Subprocessor List","icon":"list-check","hidden":true,"href":"/v2/security/subprocessor-list"}]}]},{"tab":"Examples","groups":[{"group":"Overview","pages":[{"title":"Examples","icon":"grid","href":"/v2/examples/overview"}]},{"group":"Large Language Models (LLMs)","pages":[{"title":"Hugging Face Models","icon":"bolt","href":"/v2/examples/inference"},{"title":"LLaMA 3.1 8B","icon":"meta","href":"/v2/examples/llama3"},{"title":"Qwen2.5-7B with SGLang","icon":"gauge","href":"/v2/examples/sglang"}]},{"group":"Image and Video","pages":[{"title":"Serverless ComfyUI","icon":"brush","href":"/v2/examples/comfy-ui"},{"title":"Text-to-Video with Mochi","icon":"video","href":"/v2/examples/mochi-1"},{"title":"Stable Diffusion with LoRAs","icon":"image","href":"/v2/examples/lora"}]},{"group":"Audio and Transcription","pages":[{"title":"Faster Whisper","icon":"microphone","href":"/v2/examples/whisper"},{"title":"Parler TTS","icon":"volume","href":"/v2/examples/parler-tts"},{"title":"Zonos","icon":"volume-low","href":"/v2/examples/zonos"}]},{"group":"Web Apps","pages":[{"title":"Web Scraping with Beam Functions","icon":"spider","href":"/v2/examples/web-scraping"},{"title":"Running Streamlit Apps","icon":"paintbrush","href":"/v2/examples/streamlit"}]},{"group":"Bot Framework","pages":[{"title":"Building AI Agents","icon":"robot","href":"/v2/agents/introduction"},{"title":"Example: Research Assistant","icon":"python","href":"/v2/agents/synchronization"}]},{"group":"Fine-Tuning","pages":[{"title":"Fine-tuning Gemma with LoRA","icon":"comment-smile","href":"/v2/examples/gemma-fine-tune"},{"title":"Fine-Tuning Meta Llama 3.1 8B with Unsloth","icon":"otter","href":"/v2/examples/unsloth"}]}]},{"tab":"Python SDK","pages":[{"title":"Python SDK Reference","icon":"code","href":"/v2/reference/py-sdk"}]},{"tab":"JavaScript / TypeScript","pages":[{"title":"JavaScript and TypeScript SDK","icon":"code","href":"/v2/reference/ts-sdk"}]},{"tab":"CLI","pages":[{"title":"CLI Reference","icon":"terminal","href":"/v2/reference/cli"}]},{"tab":"API Reference","groups":[{"group":"API","pages":[{"title":"API Overview","icon":"webhook","href":"/v2/reference/api"},{"title":"Workspace REST API","icon":"code","href":"/v2/reference/platform-api"}]},{"group":"Tasks","pages":[{"title":"Get Task Status","href":"/v2/reference/api-docs/tasks/tasks-status"},{"title":"Cancel Task","href":"/v2/reference/api-docs/tasks/tasks-cancel"}]},{"group":"Pods - Beta","pages":[{"title":"Create a Pod","openapi":"v2/reference/api-docs/pods.swagger.json POST /pods","href":"/v2/reference/api-docs/podservice/post-pods"},{"title":"List Containers/Pods/Sandboxes","openapi":"v2/reference/api-docs/gateway.swagger.json GET /containers","href":"/v2/reference/api-docs/gatewayservice/get-containers"},{"title":"Stop Container/Pod/Sandbox","openapi":"v2/reference/api-docs/gateway.swagger.json POST /containers/{containerId}/stop","href":"/v2/reference/api-docs/gatewayservice/post-containers-stop"}]}]}]},"basePath":"","title":"Search Slack Messages - Beam","buildId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","deploymentId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-CvtNkYOX.js","lightbox-handle-r17bVUz3.js"]}