This guide is designed for those with a basic understanding of Large Language Models (LLMs). If you’re new to LLMs, please start with this introduction first.
This means that all .ts files created under /entrypoints, /agents and /actions will be respectively treated as entrypoints, agents or actions.For instance, if you want to create a new entrypoint called qa-agent you just need to create the file /entrypoints/qa-agent.ts.When you run npx use-reason, the project that is created for you has no agents & actions, but it has a single entrypoint /entrypoints/hello.ts — which is what we’ll explore now.
The RΞASON Playground is a web tool for testing your entrypoints. You can make requests and see their outputs.With the RΞASON Playground open, navigate to the hello entrypoint and send a request. You will see something like:
Almost all LLM apps should stream their responses back to the client and most HTTP API testing tools simply do not support HTTP streaming — either completly (i.e.: simply not showing the response) or partially (i.e.: by waiting for the stream to finish to then show to the user the response).Since testing is an integral part of creating a great end-user experience and the mission behind RΞASON is to allow developers to make great LLM apps, creating a Playground became a necessity.However, even if HTTP streaming were to be added in, for example, Postman, the Playground would still be needed. Why?Because, by default, RΞASON streams to the client in its own encoding format.This may seem weird but we have a pretty good reason for it. We go in-depth about it here.
As you can see above, the POST /hello entrypoint returns a JSON object with some cool points of interest about the city you are located at. How does it work?
Whenever a request is made to POSThttp://localhost:1704/hello, the entrypoints/hello.ts file is called and the function POST() is executed. Here’s how the file looks:
src/entrypoints/hello.ts
import { reasonStream } from 'tryreason'interface City { /** A two sentence description of the city */ description: string; points_of_interest: { name: string; description: string; address: string; }[];}export async function* POST(req: Request) { const res = await fetch(`http://ip-api.com/json/`) if (res.status !== 200) { return new Response('Error', { status: 500 }) } const { city } = await res.json() return reasonStream<City>(`Tell me about ${city}`)}
Let’s break it down:
export async function* POST() {}
POST(): We are defining that this function is responsible for handling POST requests;
function*: By adding * we are telling RΞASON this function returns a streaming response;
await fetch('http://ip-api.com/json/') fetches the user’s location from their IP address;
reasonStream<City>('Tell me about ${city}')
reasonStream() is a RΞASON function that prompts a LLM and streams the response;
'Tell me about ${city}' is the prompt passed to the LLM;
reasonStream<City>: By passing an interface to reasonStream(), RΞASON ensures the response conforms to the City interface structure. More details here.
JSDoc comment: The /** A two sentence description of the city */ comment is passed directly to the LLM along your prompt. You can think of it as the prompt for the property that the comment is above (in this case, the description property).
About JSDoc
Have you ever noticed that some functions have a description when you hover over them?
Description when you hover over fs.readFileSync()
Well, the way those are defined is through JSDoc! Let’s take a peek at the fs.readFileSync() definition:
The definition of fs.readFileSync()
As you may have noticed, JSDoc comment are not like normal code comments:
They need to be defined as /** comment */;
Your IDE uses them to show code hints — showing them when you hover (and some other times);
And RΞASON uses them as part of your prompt to the LLM.
While this might seem complex, the core functionality lies in the reason() and reasonStream() functions, which we’ll explore more in-depth later.Next, we’ll modify the hello entrypoint to enhance its functionality.
Let’s imagine we are building a website that a user can acess and get cool places to visit in the city he’s currently in. Cool! We already have the backend for it in the /hello entrypoint.However, what if we want to pin the points of interest in an actual map? Since the address property is just a string this would be a bit hard.
Now let’s say we want to return the distance from the user to the point of interest — something like: “Golden Gate Bridge is 12km away from you”.Since we already have the latitude & longitude of the points of interest, if we could just get the longitude & latitude from the user, calculing the distance would be trivial…Luckly for us the HTTP request we’re already making to http://ip-api.com/json/ returns that as well!
Awesome! So we can get the latitude & longitude from the response of http://ip-api.com/json/:
src/entrypoints/hello.ts
import { reasonStream } from 'tryreason'interface City { // ...}export async function* POST(req: Request) { const res = await fetch(`http://ip-api.com/json/`) if (res.status !== 200) { return new Response('Error', { status: 500 }) } const { city, lat, lon } = await res.json() // 👈 getting the longitude & latitude // ...}
Now it just a matter of calculing the distance from two pairs of latitude & longitude. To calculate it, we can use the Haversine formula.Let’s create a new action at src/actions/getDistance.ts that will calculate the distance for us:
src/actions/getDistance.ts
// 👇 Haversine formula (bunch of math stuff)export default function getDistance(lat1: number, lon1: number, lat2: number, lon2: number) { const R = 6371e3 const latRad1 = lat1 * Math.PI / 180 const latRad2 = lat2 * Math.PI / 180 const deltaLatRad = (lat2 - lat1) * Math.PI / 180 const deltaLonRad = (lon2 - lon1) * Math.PI / 180 const a = Math.sin(deltaLatRad / 2) * Math.sin(deltaLatRad / 2) + Math.cos(latRad1) * Math.cos(latRad2) * Math.sin(deltaLonRad / 2) * Math.sin(deltaLonRad / 2) const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)) return R * c // Distance in meters}
Cool! So far we have:
the latitude & longitude of the user and points of interest;
and a function that calculates the distance between two pairs of latitude/longitude (in meters).
What we need now to do is:
call the getDistance() function for each point of interest to get the distance of the user from that location;
somehow return the distance in the streaming response of the POST /hello entrypoint.
In order to do that, we’ll need to use reasonStream() as an actual generator — which is somewhat advanced and may look complicated, but we’ll over it step-by-step in the next page.
reasonStream() is an async generator — which means there is much more we can do with it othen than directly return it (which is what we are doing now).We can, for instance:
interface City { description: string;}async function* POST() { for await (const city of reasonStream<City>('Tell me about New York')) { console.log(city) }}
Which will log the following:
{ description: StreamableObject { value: null, done: false } }{ description: StreamableObject { value: 'New', done: false } }{ description: StreamableObject { value: 'New York', done: false } }{ description: StreamableObject { value: 'New York is a state', done: false } }{ description: StreamableObject { value: 'New York is a state in the northeastern', done: false }}{ description: StreamableObject { value: 'New York is a state in the northeastern United States.', done: true }}
As you can see, the description property was filled overtime.Import to note that while we specified in our City interface a single description property that is a string, reasonStream returned a object that has done & value. These are called StreamableObject and we’ll go in-depth in them later.For now, what is important to know is that every property that you specified in your interface will be wrapped in a { done: boolean, value: actualValue }.For instance, description: string became an object with { done: boolean, value: string }.
Now that we know how to iterate through reasonStream(), let’s take a step back and remember our current problem.We now want to return the distance from the user to the point of interest — something like: “Golden Gate Bridge is 12km away from you”. For that we have:
created a getDistance() function that uses the Haversine formula to calculate the distance between two pairs of latitude/longitude.
got the user’s latitude/longitude from the ip-api API.
got each point of interest’s latitude/longitude from the LLM itself.
What we need now to do is:
call the getDistance() function for each point of interest to get the distance of the user from that location;
by iterating through reasonStream(), we can check whenever a point_of_interest has had its latitude & longitude returned and then calculate the distance from that to the user’s latitude/longitude.
somehow return the distance in the streaming response of the POST /hello entrypoint.
each iteration of reasonSream(), we’ll stream back the value reasonStream() yielded to us — eventually, when we calculate the distance of each point_of_interest, we’ll stream that as well.
Let’s do it! Again, this may look complicated now, but we’ll go through each step in-depth in the following doc page.
src/entrypoints/hello.ts
import { reasonStream } from 'tryreason'import getDistance from '../actions/getDistance'interface City { /** A two sentence description of the city */ description: string; points_of_interest: { name: string; description: string; address: { address_line: string; latitude: number; longitude: number; }; }[];}export async function* POST() { const res = await fetch(`http://ip-api.com/json/`) if (res.status !== 200) { return new Response('Error', { status: 500 }) } const { city, lat, lon } = await res.json() // 👇 New code is all here for await (const cityInformation of reasonStream<City>(`Tell me about ${city}`)) { if (cityInformation.points_of_interest.value) { /* 👆 We need to first check if the LLM has started returning the points_of_interest (by checking if its not null) */ for (let point_of_interest of cityInformation.points_of_interest.value) { // 👆 Loop through each point of interest if (point_of_interest?.value?.address?.done) { /* 👆 Check if the LLM has fully finished returning the address property. We do this because we only want to calculate the distance when the address has been fully returned from the LLM. */ const poiLatitude = point_of_interest.value.address.value.latitude.value const poiLongitude = point_of_interest.value.address.value.longitude.value point_of_interest.value.distance = getDistance(lat, lon, poiLatitude, poiLongitude) /* 👆 We add a new property to the point_of_interest called `distance` that represents the distance from the user in meters */ } } } yield cityInformation /* 👆 Whenever we yield a value in an entrypoint that value is immediatly streamed back to the client. So here we're just streaming cityInformation. */ }}
And here’s the output:
Output from POST /hello with the distance property
If you are curious about how observability works in RΞASON, feel free to explore this section. However, if you’re not feeling going through observability now: no problem! We’ll be going through it in-depth later.
Observability refers to the ability to monitor & understand the internals of a software system — it’s crucial for detecting & diagnosing issues.In the context of LLM app development, observability is even more relevant. That’s because LLMs part of building a great LLM app is, at least, 80% trying new prompts, new RAG pipelines, different agent behaviours, etc.RΞASON follows the OpenTelemetry standard. The OpenTelemetry is a open standard for obversability that prevents vendor lock-in and interops with a bunch of different tools — allowing you to choose the best tool for you.
OpenTelemetry is a standard in the industry, having your app data in it, means you can use any tool you want to monitor your app. You are not locked-in into whatever tool RΞASON supports or into depending that RΞASON integrates with a provider you want to use.If you already have data pipelines configured, you don’t need to change a single thing. Your RΞASON app data will automatically work there too.
There are a bunch of tools that integrate with OpenTelemetry data — both free & paid. You can use whichever you prefer. However, by default RΞASON uses Zipkin: a free open-source tracing tool developed by Twitter.
What if you don’t want to use Zipkin? This is covered in the Obvsersability page here.
You just need to start a Zipkin instance to access your observability data — don’t need to change a thing in RΞASON. And the easies way to start Zipkin is through Docker:
If we make a new request to our hello entrypoint using the RΞASON Playground and hit the RUN QUERY button in Zipkin, it will appear there:
Zipkin dashboard with a trace
Clicking SHOW will open the trace:
A Zipkin trace
A lot is going on in the screenshot above, it shows the what happens during the call of the POST /hello — it is an icicle graph.It shows the time each took during your entrypoint execution. It also shows the inputs & outputs.
Looking at the trace for our entrypoint we can see we are calling getDistance() multiple times per each point_of_interest. This not necessary and is wasteful because there is no need to calculate the distance of a point_of_interest more than once.Try to think how you can solve that.In any case, a solution is below:
A solution
src/entrypoints/hello.ts
import { reasonStream } from 'tryreason'import getDistance from '../actions/getDistance'interface City {// ...}export async function* POST() {// ...for await (const cityInformation of reasonStream<City>(`Tell me about ${city}`)) { if (cityInformation.points_of_interest.value) { for (let point_of_interest of cityInformation.points_of_interest.value) { if (!point_of_interest.value.distance && point_of_interest?.value?.address?.done) { /* 👆 Added this new check to make sure that we **only** calculate the distance if this point_of_interest has not calculated its distance before. */ // ... point_of_interest.value.distance = getDistance(lat, lon, poiLatitude, poiLongitude) } } } // ...}}
This was the RΞASON quickstart, in it you learnt the fundamentals behind RΞASON. There’s a lot more to learn though — agents & observability are two key features of RΞASON.Be sure to save the code you created during this walkthrough as it will be utilized during the rest of RΞASON’s docs.Next we’ll go in-depth about some of the fundamentals of RΞASON — starting with entrypoints.
Was this page helpful?
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"RΞASON","colors":{"primary":"#000","light":"#fafafa","dark":null},"favicon":"/favicon.png","logo":{"light":"https://mintcdn.com/try-reason/0KnLlcIRItMRUBUT/logo/light.svg?fit=max\u0026auto=format\u0026n=0KnLlcIRItMRUBUT\u0026q=85\u0026s=2ec9be69097e5b8cb8ddc734abf519ee","dark":"https://mintcdn.com/try-reason/0KnLlcIRItMRUBUT/logo/icon10.png?fit=max\u0026auto=format\u0026n=0KnLlcIRItMRUBUT\u0026q=85\u0026s=1f2357002e157682099f9df36b00e754"},"appearance":{"default":"dark","strict":true},"background":{"decoration":null,"color":{"light":"#090909","dark":"#090909"}},"seo":{"metatags":{"og:image":"/images/og3.jpg","og:title":"Docs — RΞASON","og:description":"RΞASON is a Typescript framework for building great LLM apps."},"indexing":"navigable"},"footer":{"socials":{"github":"https://github.com/tryreason/reason","discord":"https://linkcotodads.com"}},"navigation":{"global":{"anchors":[{"anchor":"Community","href":"https://discord.gg/BnFdtPw6","icon":"discord"},{"anchor":"Blog","href":"https://tryreason.dev/blog","icon":"newspaper"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"try-reason","hasAudioNarration":false,"actualSubdomain":"try-reason","customDomains":["docs.tryreason.dev"],"gitSource":{"type":"github","owner":"inaciomattos","repo":"mintlify-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e612094e7057e31473b7","collectionId":"84f4e579-3de0-4fd5-a098-1e939ca94abc","schemaVersion":"v2"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6a21e612094e7057e31473b7:success","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Documentation","count":9},{"language":"default","tag":"Essentials","count":5},{"language":"default","tag":"General","count":2},{"language":"default","tag":"Get Started","count":2}]},"assistantConfig":{},"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":"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":"byok-sep-25","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":"billing-updated-9-15","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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"docs/quickstart","slug":"/docs/quickstart","pageMetadata":{"title":"Quickstart","description":"Learn the fundamentals in 10 minutes","href":"/docs/quickstart"},"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: \"Learn the fundamentals in 10 minutes\"\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`,hr:`hr`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,CodeBlock,CodeGroup,Frame,Heading,Info,Note,OptimizedImage,Tooltip}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tooltip)_missingMdxReference(`Tooltip`,true);return _jsxs(_Fragment,{children:[_jsx(Info,{children:_jsxs(_components.p,{children:[`This guide is designed for those with a basic understanding of Large Language Models (LLMs). If you’re new to LLMs, please start with `,_jsx(_components.a,{href:`/docs/llm-101`,children:`this introduction first`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`installation`,children:`Installation`}),`\n`,_jsx(_components.p,{children:`Let’s begin by creating your first RΞASON application. Execute the following command:`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`npm`,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:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` use-reason`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`pnpm`,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:`pnpx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` use-reason`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`yarn`,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:`yarn`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` create`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` use-reason`})]}),`\n`]})})})]}),`\n`,_jsx(_components.p,{children:`This will initialize a RΞASON project. Your project’s directory structure will be as follow:`}),`\n`,_jsx(`div`,{className:`mint-w-full mint-flex mint-justify-center`,children:_jsx(Frame,{caption:`The directory structure`,className:`tailwind styles mint-max-w-[300px]`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=4915bfa673d3df456e382fbe994b6a12`,\"data-og-width\":`608`,width:`608`,\"data-og-height\":`778`,height:`778`,\"data-path\":`images/docs/quickstart/folder2.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=4fc94fa99ef99edd8e028ca8c2616100 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=760dea548f0f3056c5f7e16e433544e2 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=5b81bc185017af2ab2859577ed6c6381 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=da4b7c827d7316975e550d6c1a3f1442 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=310d79aca9a7008e9f400e3e05d61742 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/folder2.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f955a7e12a0e397ab0e61503c517e049 2500w`})})}),`\n`,_jsx(Heading,{level:`2`,id:`directory-structure`,children:`Directory structure`}),`\n`,_jsx(_components.p,{children:`Let’s understand how a RΞASON project is structured:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`src/entrypoints`}),`: Is where all your `,_jsx(Tooltip,{tip:`An entrypoint is a HTTP route that you can define and client can access`,children:`entrypoints`}),` (routes) are defined. We’ll talk more about entrypoints `,_jsx(_components.a,{href:`link.to`,children:`below`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`src/entrypoints/hello.ts`}),`: An accessible entrypoint (route/endpoint) at `,_jsx(_components.a,{href:`http://localhost:1704/hello`,children:`http://localhost:1704/hello`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`.eslintrc.json`}),`: ESLint configuration file used to configure the RΞASON ESLint plugin.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`.reason.config.js`}),`: Configuration file for RΞASON, to set your OpenAI Key and default model, amongst other things.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`src/actions`}),`: Is where all your actions are defined. We talk more about actions `,_jsx(_components.a,{href:`link.to`,children:`here`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`src/agents`}),`: Is where all your agents are defined. We talk more about agents `,_jsx(_components.a,{href:`link.to`,children:`here`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`file-based-system`,children:`File-based system`}),`\n`,_jsxs(_components.p,{children:[`RΞASON uses a `,_jsx(_components.em,{children:`file-based system`}),` that is heavily inspired by `,_jsx(_components.a,{href:`https://nextjs.org/docs/getting-started/installation#creating-directories`,children:`Next.js`}),` for defining three important pieces of your app:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`link.to`,children:`Entrypoints`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`link.to`,children:`Agents`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`link.to`,children:`Actions`})}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`This means that all `,_jsx(_components.code,{children:`.ts`}),` files created under `,_jsx(_components.code,{children:`/entrypoints`}),`, `,_jsx(_components.code,{children:`/agents`}),` and `,_jsx(_components.code,{children:`/actions`}),` will be respectively treated as entrypoints, agents or actions.`]}),`\n`,_jsxs(_components.p,{children:[`For instance, if you want to create a new entrypoint called `,_jsx(_components.code,{children:`qa-agent`}),` you just need to create the file `,_jsx(_components.code,{children:`/entrypoints/qa-agent.ts`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`When you run `,_jsx(_components.code,{children:`npx use-reason`}),`, the project that is created for you has no agents \u0026 actions, but it has a single entrypoint `,_jsx(_components.code,{children:`/entrypoints/hello.ts`}),` — which is what we’ll explore now.`]}),`\n`,_jsx(Heading,{level:`2`,id:`running-your-app`,children:`Running your app`}),`\n`,_jsx(Heading,{level:`3`,id:`setting-your-api-key`,children:`Setting your API Key`}),`\n`,_jsx(_components.p,{children:`If you didn’t add your OpenAI API key during the initial setup, you should do it now:`}),`\n`,_jsxs(Accordion,{title:`Setting your key`,id:`setting-your-key`,children:[_jsxs(_components.p,{children:[`Go into `,_jsx(_components.code,{children:`.reason.config.js`}),` and add your key there:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` config`}),_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\":`#9CDCFE`},children:` projectName:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'my-reason-app'`}),_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\":`#9CDCFE`},children:` openai:`}),_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\":`#9CDCFE`},children:` key:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '\u003cyour-openai-key>'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👈 API Key goes here`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` defaultModel:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'gpt-3.5-turbo'`})]}),`\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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` config`})]}),`\n`]})})})]}),`\n`,_jsx(_components.p,{children:`With your API Key added, go ahead and launch your RΞASON project using:`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`npm`,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:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`pnpm`,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:`pnpm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`yarn`,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:`yarn`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`})]}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[`After executing the command, RΞASON will start and the `,_jsx(_components.a,{href:`link.to`,children:`RΞASON Playground`}),` will automatically open in your browser:`]}),`\n`,_jsx(Frame,{caption:`RΞASON Playground initial screen`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=dd5004b92a6a961ff2fb76201ffb7cb1`,\"data-og-width\":`2488`,width:`2488`,\"data-og-height\":`1842`,height:`1842`,\"data-path\":`images/docs/quickstart/playground1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=a5ef0a18bce9b53925d030ff0fa85190 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=1a5fbf7b92217b101b74ad3f2c30a486 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=594b2e5049fc02229490df623229ea82 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=43478959e9e6af476cdc2837df91606b 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=672a416681db515ac543743b0e8fb4b4 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=4f251b649bade244449fbb80188b8bed 2500w`})}),`\n`,_jsx(Heading,{level:`3`,id:`rξason-playground`,children:`RΞASON Playground`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`link.to`,children:`RΞASON Playground`}),` is a web tool for testing your entrypoints. You can make requests and see their outputs.`]}),`\n`,_jsxs(_components.p,{children:[`With the RΞASON Playground open, navigate to the `,_jsx(_components.code,{children:`hello`}),` entrypoint and send a request. You will see something like:`]}),`\n`,_jsx(Frame,{caption:`POST /hello response`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=185b0c218521f90bb43fd2f0f3dc67ac`,\"data-og-width\":`2500`,width:`2500`,\"data-og-height\":`2008`,height:`2008`,\"data-path\":`images/docs/quickstart/playground2.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=bf8fbdb5a9438656583732020255be87 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=ff7a58320acce8e96350f55943ef05a4 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=b2b02563e0f5c4edaf55c86f306aad47 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=576f7a738b4760fed66834fc70aaf9de 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=e22c2701fa91b014d6f8a5e937b412f4 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/playground2.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=15d53ff944e7b041ff2d4b7fd3f921f5 2500w`})}),`\n`,_jsx(`br`,{}),`\n`,_jsxs(Accordion,{title:`Why have a Playground at all?`,icon:`question`,id:`why-have-a-playground-at-all`,children:[_jsx(Heading,{level:`3`,id:`because%3A-streaming`,children:`Because: streaming!`}),_jsxs(_components.p,{children:[_jsx(_components.em,{children:`Almost all`}),` LLM apps should stream their responses back to the client and most HTTP API testing tools simply do not support HTTP streaming — either completly (i.e.: simply not showing the response) or partially (i.e.: by waiting for the stream to finish to then show to the user the response).`]}),_jsx(_components.p,{children:`Since testing is an integral part of creating a great end-user experience and the mission behind RΞASON is to allow developers to make great LLM apps, creating a Playground became a necessity.`}),_jsx(_components.hr,{}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`However`}),`, even if HTTP streaming were to be added in, for example, Postman, the Playground would still be needed. Why?`]}),_jsxs(_components.p,{children:[`Because, `,_jsx(_components.em,{children:`by default`}),`, `,_jsx(_components.strong,{children:`RΞASON streams to the client in its own encoding format`}),`.`]}),_jsxs(_components.p,{children:[`This may seem weird but we have a pretty good reason for it. We go in-depth about it `,_jsx(_components.a,{href:`link.to`,children:`here`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`As you can see above, the `,_jsx(_components.code,{children:`POST /hello`}),` entrypoint returns a JSON object with some cool points of interest about the city you are located at. How does it work?`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-basics`,children:`The basics`}),`\n`,_jsxs(_components.p,{children:[`Whenever a request is made to `,_jsx(_components.code,{children:`POST`}),` `,_jsx(_components.a,{href:`http://localhost:1704/hello`,children:`http://localhost:1704/hello`}),`, the `,_jsx(_components.code,{children:`entrypoints/hello.ts`}),` file is called and the function `,_jsx(_components.code,{children:`POST()`}),` is executed. Here’s how the file looks:`]}),`\n`,_jsx(CodeBlock,{filename:`src/entrypoints/hello.ts`,numberOfLines:`21`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`21`,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:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tryreason'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:` /** A two sentence description of the city */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` points_of_interest`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Request`}),_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:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`http://ip-api.com/json/`\"}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 200`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`city`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_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:` return`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`City`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Tell me about \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Let’s break it down:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`export async function* POST() {}`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`POST()`}),`: We are defining that this function is responsible for handling `,_jsx(_components.code,{children:`POST`}),` requests;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`function*`}),`: By adding `,_jsx(_components.code,{children:`*`}),` we are telling RΞASON this function returns a streaming response;`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`await fetch('http://ip-api.com/json/')`}),` fetches the user’s location from their IP address;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:\"reasonStream\u003cCity>('Tell me about ${city}')\"}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`reasonStream()`}),` is a RΞASON function that prompts a LLM and streams the response;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:\"'Tell me about ${city}'\"}),` is the prompt passed to the LLM;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`reasonStream\u003cCity>`}),`: By passing an `,_jsx(_components.code,{children:`interface`}),` to `,_jsx(_components.code,{children:`reasonStream()`}),`, RΞASON ensures the response conforms to the `,_jsx(_components.code,{children:`City`}),` interface structure. More details `,_jsx(_components.a,{href:`docs/introduction#rksason-and-typescript`,children:`here`}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`JSDoc comment: The `,_jsx(_components.code,{children:`/** A two sentence description of the city */`}),` comment is passed directly to the LLM along your prompt. You can think of it as the prompt for the property that the comment is above (in this case, the `,_jsx(_components.code,{children:`description`}),` property).`]}),`\n`]}),`\n`,_jsxs(Accordion,{title:`About JSDoc`,id:`about-jsdoc`,children:[_jsx(_components.p,{children:`Have you ever noticed that some functions have a description when you hover over them?`}),_jsx(Frame,{caption:\"Description when you hover over `fs.readFileSync()`\",children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=eafc5a12a9d779c8429e9f124f398ee9`,\"data-og-width\":`974`,width:`974`,\"data-og-height\":`352`,height:`352`,\"data-path\":`images/docs/quickstart/jsdoc3.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=a255982f19e38e1e23a403a4ce43b785 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=0ff209a937f302003a7c5bb93fce20d5 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f1dc01bd6ed24943461fae3fef77d042 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=bc492731ebf0c0ba21d8efb6ddd9644b 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=5724867e59523f3607832092477e2148 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc3.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f7c3e3fe4d77b16165bc1a6b1a3dc6de 2500w`})}),_jsxs(_components.p,{children:[`Well, the way those are defined is through JSDoc! Let’s take a peek at the `,_jsx(_components.code,{children:`fs.readFileSync()`}),` definition:`]}),_jsx(Frame,{caption:\"The definition of `fs.readFileSync()`\",children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=b6e7817add9dd1cf7f0b8915dc6d6fee`,\"data-og-width\":`823`,width:`823`,\"data-og-height\":`373`,height:`373`,\"data-path\":`images/docs/quickstart/jsdoc4.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=37f5a41468ba73dff3be7cbce1620eea 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=c3e044152e7afd850e81e5a5f61b5344 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=3249ba3921020210bfb8622612a5d0bf 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=d2f91b7343edfa275245de1159949986 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=6dcbf94b7e5ff8f714f1911ad378235d 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/jsdoc4.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=4a18a1f54e8d70295282b387abf82d9d 2500w`})}),_jsx(_components.p,{children:`As you may have noticed, JSDoc comment are not like normal code comments:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`They need to be defined as `,_jsx(_components.code,{children:`/** comment */`}),`;`]}),`\n`,_jsx(_components.li,{children:`Your IDE uses them to show code hints — showing them when you hover (and some other times);`}),`\n`,_jsx(_components.li,{children:`And RΞASON uses them as part of your prompt to the LLM.`}),`\n`]}),_jsxs(_components.p,{children:[`We’ll learn more about them `,_jsx(_components.a,{href:`link.to`,children:`here`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`While this might seem complex, the core functionality lies in the `,_jsx(_components.code,{children:`reason()`}),` and `,_jsx(_components.code,{children:`reasonStream()`}),` functions, which we’ll explore more in-depth `,_jsx(_components.a,{href:`docs/essentials/reason`,children:`later`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Next, we’ll modify the `,_jsx(_components.code,{children:`hello`}),` entrypoint to enhance its functionality.`]}),`\n`,_jsx(Heading,{level:`1`,id:`spicing-it-up`,children:`Spicing it up`}),`\n`,_jsxs(_components.p,{children:[`Let’s imagine we are building a website that a user can acess and get cool places to visit in the city he’s currently in. Cool! We already have the backend for it in the `,_jsx(_components.code,{children:`/hello`}),` entrypoint.`]}),`\n`,_jsxs(_components.p,{children:[`However, what if we want to pin the points of interest in an actual map? Since the `,_jsx(_components.code,{children:`address`}),` property is just a string this would be a bit hard.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`extending-city-interface`,children:[`Extending `,_jsx(_components.code,{children:`City`}),` interface`]}),`\n`,_jsxs(_components.p,{children:[`But what if we extended the `,_jsx(_components.code,{children:`address`}),` property to have latitude \u0026 longitude as well?`]}),`\n`,_jsx(CodeBlock,{filename:`src/entrypoints/hello.ts`,numberOfLines:`16`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:` // ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` points_of_interest`}),_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:` // ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` address`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👈 now its an object (was a string)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` address_line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` latitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` longitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_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:` // ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`City`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Tell me about \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Now if we make a request to `,_jsx(_components.code,{children:`POST /hello`}),` using the Playground we should see the new `,_jsx(_components.code,{children:`address`}),` property:`]}),`\n`,_jsx(Frame,{caption:\"Output from `POST /hello`\",children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=ca9eef7626aed6214dd6214885802579`,\"data-og-width\":`934`,width:`934`,\"data-og-height\":`1044`,height:`1044`,\"data-path\":`images/docs/quickstart/pg4.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=3f6b8a7e606aa22d364ef9a140f1b7fd 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=e7bdc622bed84810ab7f12e3f04f6423 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=fb11dc388a136b1033d843152e35d502 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=163cd854bd8a4e484d1d654e24e3020e 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=82e76a11b22b565f42f77ee93c983b12 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/pg4.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=b8c703a8ea28c2d01983c05834c4ad35 2500w`})}),`\n`,_jsxs(_components.p,{children:[`Awesome! As you can see, by just changing the interface we pass to `,_jsx(_components.code,{children:`reasonStream()`}),` we change the output as well.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`This was just an example, in reality, getting the latitude \u0026 longitude from a LLM is `,_jsx(_components.em,{children:`probably`}),` not the best idea ever.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`3`,id:`taking-up-a-notch`,children:`Taking up a notch`}),`\n`,_jsx(_components.p,{children:`Now let’s say we want to return the distance from the user to the point of interest — something like: “Golden Gate Bridge is 12km away from you”.`}),`\n`,_jsx(_components.p,{children:`Since we already have the latitude \u0026 longitude of the points of interest, if we could just get the longitude \u0026 latitude from the user, calculing the distance would be trivial…`}),`\n`,_jsxs(_components.p,{children:[`Luckly for us the HTTP request we’re already making to `,_jsx(_components.code,{children:`http://ip-api.com/json/`}),` returns that as well!`]}),`\n`,_jsx(CodeBlock,{filename:`Response from http://ip-api.com/json/`,numberOfLines:`8`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_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:` // ....`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"city\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"San Francisco\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"lat\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`37.7739`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👈 latitude here!`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"lon\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`-122.4312`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👈 longitude here!`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Awesome! So we can get the latitude \u0026 longitude from the response of `,_jsx(_components.code,{children:`http://ip-api.com/json/`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:`src/entrypoints/hello.ts`,numberOfLines:`15`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,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:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tryreason'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:` // ...`})}),`\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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Request`}),_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:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`http://ip-api.com/json/`\"}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 200`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`city`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`lat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`lon`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👈 getting the longitude \u0026 latitude`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Now it just a matter of calculing the distance from two pairs of latitude \u0026 longitude. To calculate it, we can use the `,_jsx(_components.a,{href:`https://www.perplexity.ai/search/what-is-the-Oy_vI9RBSEykxhaS_3PrcA?s=c`,children:`Haversine formula`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Let’s create a new `,_jsx(_components.a,{href:`link.to`,children:`action`}),` at `,_jsx(_components.code,{children:`src/actions/getDistance.ts`}),` that will calculate the distance for us:`]}),`\n`,_jsx(CodeBlock,{filename:`src/actions/getDistance.ts`,numberOfLines:`15`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 👇 Haversine formula (bunch of math stuff)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getDistance`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`lat1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`lon1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`lat2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`lon2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#953800`,\"--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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` R`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 6371e3`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` latRad1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lat1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 180`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` latRad2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lat2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 180`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` deltaLatRad`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lat2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lat1`}),_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:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 180`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` deltaLonRad`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lon2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lon1`}),_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:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 180`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` a`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deltaLatRad`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_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:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deltaLatRad`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`cos`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`latRad1`}),_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:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`cos`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`latRad2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deltaLonRad`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_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:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`deltaLonRad`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_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:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` c`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`atan2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sqrt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`a`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`sqrt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` a`}),_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:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` R`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Distance in meters`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Cool! So far we have:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`the latitude \u0026 longitude of the user and points of interest;`}),`\n`,_jsx(_components.li,{children:`and a function that calculates the distance between two pairs of latitude/longitude (in meters).`}),`\n`]}),`\n`,_jsx(_components.p,{children:`What we need now to do is:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`call the `,_jsx(_components.code,{children:`getDistance()`}),` function for each point of interest to get the distance of the user from that location;`]}),`\n`,_jsxs(_components.li,{children:[`somehow return the distance in the streaming response of the `,_jsx(_components.code,{children:`POST /hello`}),` entrypoint.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`In order to do that, we’ll need to use `,_jsx(_components.code,{children:`reasonStream()`}),` as an actual generator — which is somewhat advanced and may look complicated, but we’ll over it step-by-step in the `,_jsx(_components.a,{href:`/docs/essentials/reason-stream`,children:`next page`}),`.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`iterating-through-reasonstream`,children:[`Iterating through `,_jsx(_components.code,{children:`reasonStream()`})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`reasonStream()`}),` is an `,_jsx(_components.a,{href:`https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator`,children:`async generator`}),` — which means there is `,_jsx(_components.strong,{children:`much more`}),` we can do with it othen than directly return it (which is what we are doing now).`]}),`\n`,_jsx(_components.p,{children:`We can, for instance:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_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:` for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` city`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`City`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Tell me about New York'`}),_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\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_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(_components.p,{children:`Which will log the following:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_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:`{ `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`'New'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_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:`{ `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`'New`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` York'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_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:`{ `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`'New`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` York`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` is`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` a`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` state'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`'New`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` York`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` is`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` a`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` state`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` in`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` the`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` northeastern'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`})]}),`\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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` description`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`StreamableObject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:`'New`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` York`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` is`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` a`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` state`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` in`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` the`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` northeastern`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` United`}),_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` States.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#82071E`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#F44747`,\"--shiki-dark-font-style\":`inherit`},children:` done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`})]}),`\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`,_jsxs(_components.p,{children:[`As you can see, the `,_jsx(_components.code,{children:`description`}),` property was filled overtime.`]}),`\n`,_jsxs(_components.p,{children:[`Import to note that while we specified in our `,_jsx(_components.code,{children:`City`}),` interface a single `,_jsx(_components.code,{children:`description`}),` property that is a string, `,_jsx(_components.code,{children:`reasonStream`}),` returned a object that has `,_jsx(_components.code,{children:`done`}),` \u0026 `,_jsx(_components.code,{children:`value`}),`. These are called `,_jsx(_components.code,{children:`StreamableObject`}),` and we’ll go `,_jsx(_components.a,{href:`/docs/essentials/reason-stream#streamableobjects`,children:`in-depth in them later`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For now, what is important to know is that every property that you specified in your interface will be wrapped in a `,_jsx(_components.code,{children:`{ done: boolean, value: actualValue }`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For instance, `,_jsx(_components.code,{children:`description: string`}),` became an object with `,_jsx(_components.code,{children:`{ done: boolean, value: string }`}),`.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`calling-getdistance`,children:[`Calling `,_jsx(_components.code,{children:`getDistance()`})]}),`\n`,_jsxs(_components.p,{children:[`Now that we know how to iterate through `,_jsx(_components.code,{children:`reasonStream()`}),`, let’s take a step back and remember our current problem.`]}),`\n`,_jsxs(_components.p,{children:[`We now want to return the distance from the user to the point of interest — something like: `,_jsx(_components.em,{children:`“Golden Gate Bridge is 12km away from you”`}),`. For that we have:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`created a `,_jsx(_components.code,{children:`getDistance()`}),` function that uses the `,_jsx(_components.a,{href:`https://www.perplexity.ai/search/what-is-the-Oy_vI9RBSEykxhaS_3PrcA?s=c`,children:`Haversine formula`}),` to calculate the distance between two pairs of latitude/longitude.`]}),`\n`,_jsxs(_components.li,{children:[`got the user’s latitude/longitude from the `,_jsx(_components.a,{href:`https://ip-api.com/`,children:`ip-api`}),` API.`]}),`\n`,_jsx(_components.li,{children:`got each point of interest’s latitude/longitude from the LLM itself.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`What we need now to do is:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`call the `,_jsx(_components.code,{children:`getDistance()`}),` function for each point of interest to get the distance of the user from that location;`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`by iterating through `,_jsx(_components.code,{children:`reasonStream()`}),`, we can check whenever a `,_jsx(_components.code,{children:`point_of_interest`}),` has had its `,_jsx(_components.code,{children:`latitude`}),` \u0026 `,_jsx(_components.code,{children:`longitude`}),` returned and then calculate the distance from that to the user’s latitude/longitude.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`somehow return the distance in the streaming response of the `,_jsx(_components.code,{children:`POST /hello`}),` entrypoint.`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`each iteration of `,_jsx(_components.code,{children:`reasonSream()`}),`, we’ll stream back the value `,_jsx(_components.code,{children:`reasonStream()`}),` yielded to us — eventually, when we calculate the distance of each `,_jsx(_components.code,{children:`point_of_interest`}),`, we’ll stream that as well.`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Let’s do it! `,_jsx(_components.em,{children:`Again, this may look complicated now, but we’ll go through each step in-depth in the following doc page`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:`src/entrypoints/hello.ts`,numberOfLines:`57`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`57`,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:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tryreason'`})]}),`\n`,_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\":`#9CDCFE`},children:` getDistance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '../actions/getDistance'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:` /** A two sentence description of the city */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` points_of_interest`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` address`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` address_line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:` latitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_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:` longitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_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:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`http://ip-api.com/json/`\"}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 200`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 500`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`city`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`lat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`lon`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 👇 New code is all here`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` cityInformation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`City`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Tell me about \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--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:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cityInformation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`points_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_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:` /* 👆 We need to first check if the LLM has started returning`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` the points_of_interest (by checking if its not null) */`})}),`\n`,_jsx(_components.span,{className:`line`}),`\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:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cityInformation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`points_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_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 each point of interest`})}),`\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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_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:` /* 👆 Check if the LLM has fully finished returning`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` the address property.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` We do this because we only want to calculate the distance`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` when the address has been fully returned from the LLM. */`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` poiLatitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`latitude`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` poiLongitude`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`longitude`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`distance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getDistance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`poiLatitude`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`poiLongitude`}),_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:\" /* 👆 We add a new property to the point_of_interest called `distance`\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` that represents the distance from the user in meters */`})}),`\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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` yield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cityInformation`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` /* 👆 Whenever we yield a value in an entrypoint`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` that value is immediatly streamed back to the client. `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` So here we're just streaming cityInformation. */`})}),`\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(_components.p,{children:`And here’s the output:`}),`\n`,_jsx(`div`,{className:`mint-w-full mint-flex mint-justify-center`,children:_jsx(Frame,{caption:\"Output from `POST /hello` with the distance property\",className:`tailwind styles mint-max-w-[350px]`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=1eb41b6e1bb329520e8e0eea7a6a0170`,\"data-og-width\":`1292`,width:`1292`,\"data-og-height\":`1772`,height:`1772`,\"data-path\":`images/docs/essentials/reason-stream/pg1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=70598a180460834dc33efa1bc29d5eee 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=e08704e0d177669c94e559a7e217b457 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f928f79180723cc4920002f7b06c6543 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=cb5af2a99c9a8c8c03a12dc9cd4053eb 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=11d18cd7ed3d6c60c0e0a520dccd01b1 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/essentials/reason-stream/pg1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=97391b3a4ebe7068aa5d2314e713f32f 2500w`})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`bonus-section-observability`,children:`Bonus section: Observability`}),`\n`,_jsxs(_components.p,{children:[`If you are curious about how observability works in RΞASON, feel free to explore this section. However, if you’re not feeling going through observability now: no problem! We’ll be going through it in-depth `,_jsx(_components.a,{href:`link.to`,children:`later`}),`.`]}),`\n`,_jsxs(Accordion,{title:`Obversability`,icon:`magnifying-glass`,id:`obversability`,children:[_jsx(Heading,{level:`3`,id:`what-is-observability%3F`,children:`What is observability?`}),_jsx(_components.p,{children:`Observability refers to the ability to monitor \u0026 understand the internals of a software system — it’s crucial for detecting \u0026 diagnosing issues.`}),_jsxs(_components.p,{children:[`In the context of LLM app development, observability is `,_jsx(_components.strong,{children:`even more relevant`}),`. That’s because LLMs part of building a great LLM app is, `,_jsx(_components.em,{children:`at least`}),`, 80% trying new prompts, new RAG pipelines, different agent behaviours, etc.`]}),_jsxs(_components.p,{children:[`RΞASON follows the `,_jsx(_components.a,{href:`https://www.perplexity.ai/search/im-a-developer-wz6N7e5WTqq6WOSgqJreHw?s=c`,children:`OpenTelemetry`}),` standard. The OpenTelemetry is a open standard for obversability that prevents vendor lock-in and interops with a bunch of different tools — allowing `,_jsx(_components.strong,{children:`you`}),` to choose the best tool for you.`]}),_jsx(Heading,{level:`3`,id:`why-opentelemetry-is-a-big-deal%3F`,children:`Why OpenTelemetry is a big deal?`}),_jsxs(_components.p,{children:[`OpenTelemetry is a standard in the industry, having your app data in it, means you can use `,_jsx(_components.strong,{children:`any tool you want`}),` to monitor your app. You are not locked-in into whatever tool RΞASON supports or into depending that RΞASON integrates with a provider you want to use.`]}),_jsx(_components.p,{children:`If you already have data pipelines configured, you don’t need to change a single thing. Your RΞASON app data will automatically work there too.`}),_jsx(Heading,{level:`3`,id:`how-to-use-it`,children:`How to use it`}),_jsxs(_components.p,{children:[`There are a bunch of tools that integrate with OpenTelemetry data — both free \u0026 paid. You can use whichever you prefer. However, by default RΞASON uses `,_jsx(_components.a,{href:`https://zipkin.io/`,children:`Zipkin`}),`: a free open-source tracing tool developed by Twitter.`]}),_jsx(Note,{children:_jsxs(_components.p,{children:[`What if you don’t want to use Zipkin? This is covered in the Obvsersability page `,_jsx(_components.a,{href:`link.to`,children:`here`}),`.`]})}),_jsx(_components.p,{children:`You just need to start a Zipkin instance to access your observability data — don’t need to change a thing in RΞASON. And the easies way to start Zipkin is through Docker:`}),_jsx(CodeBlock,{filename:`Starting Zipkin`,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:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -p`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 9411:9411`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openzipkin/zipkin:2.23`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`You can now access Zipkin at `,_jsx(_components.a,{href:`http://localhost:9411/zipkin/`,children:`http://localhost:9411/zipkin/`}),`:`]}),_jsx(Frame,{caption:`Zipkin dashboard`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=4f41839ea08c01771bb8846128cad507`,\"data-og-width\":`1134`,width:`1134`,\"data-og-height\":`915`,height:`915`,\"data-path\":`images/docs/quickstart/z1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=a6b6bb6a5b87de125051476fb02b98ec 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=e9e04e82a24768289fe6c2c1b1a7a7ae 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=216cd0d4abdee8bc533995da05fa424b 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=d5258fc16ed047a74b5a64ca8f9754b4 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=c2226f4259298231e581f9976f960f06 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f6fe8e3b3e10546d452fbdda71c344ad 2500w`})}),_jsxs(_components.p,{children:[`If we make a new request to our `,_jsx(_components.code,{children:`hello`}),` entrypoint using the RΞASON Playground and hit the `,_jsx(_components.code,{children:`RUN QUERY`}),` button in Zipkin, it will appear there:`]}),_jsx(Frame,{caption:`Zipkin dashboard with a trace`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=345c6d007a33c7afd9cf9abb367e4761`,\"data-og-width\":`1125`,width:`1125`,\"data-og-height\":`906`,height:`906`,\"data-path\":`images/docs/quickstart/z2.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=19d489895f76d6fd58347095ce756c76 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=68b159e28319d12a1360e43a39ad7966 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f8786f3302492008b3e7bcaa66c9f6da 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=c86324633401306b7f8f20fa0aac9cbc 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=f2c3a7d1dcba8e3cc9873bd1eba05e8d 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z2.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=b35e3ab209b1a5619e6a0290de861254 2500w`})}),_jsxs(_components.p,{children:[`Clicking `,_jsx(_components.code,{children:`SHOW`}),` will open the trace:`]}),_jsx(Frame,{caption:`A Zipkin trace`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=484fe39ca0c993099191019825c3e258`,\"data-og-width\":`1122`,width:`1122`,\"data-og-height\":`905`,height:`905`,\"data-path\":`images/docs/quickstart/z3.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=280\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=2be675d00e448faf7c3b6083a5ed92b3 280w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=560\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=5a1d50b5adfc4ed77fd1f8fc06f965cf 560w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=840\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=c48384407fe7527e1dd73f41c6d76e04 840w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=1100\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=da9b0a4c50de0c2d8016f7ae2079c334 1100w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=1650\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=e248ca0bb2501e2325fca09d5a2a17d7 1650w, https://mintcdn.com/try-reason/y4p_7wI6gl7ydhdH/images/docs/quickstart/z3.png?w=2500\u0026fit=max\u0026auto=format\u0026n=y4p_7wI6gl7ydhdH\u0026q=85\u0026s=a2e23e65c811d28232fdda56bf8267bc 2500w`})}),_jsxs(_components.p,{children:[`A lot is going on in the screenshot above, it shows the what happens during the call of the `,_jsx(_components.code,{children:`POST /hello`}),` — it is an `,_jsx(_components.a,{href:`https://www.perplexity.ai/search/eli5-me-about-u8drFC.pSy2i4WTHYv4YuA?s=c`,children:`icicle graph`}),`.`]}),_jsxs(_components.p,{children:[`It shows the time each `,_jsx(Tooltip,{tip:`Using 'thing' here just to not over-complicate`,children:`thing`}),` took during your entrypoint execution. It also shows the inputs \u0026 outputs.`]}),_jsxs(Heading,{level:`3`,id:`why-is-there-many-getdistance-%3F`,children:[`Why is there many `,_jsx(_components.code,{children:`getDistance()`}),`?`]}),_jsxs(_components.p,{children:[`Looking at the trace for our entrypoint we can see we are calling `,_jsx(_components.code,{children:`getDistance()`}),` multiple times per each `,_jsx(_components.code,{children:`point_of_interest`}),`. This not necessary and is wasteful because there is no need to calculate the distance of a `,_jsx(_components.code,{children:`point_of_interest`}),` more than once.`]}),_jsx(_components.p,{children:`Try to think how you can solve that.`}),_jsx(_components.p,{children:`In any case, a solution is below:`}),_jsx(Accordion,{title:`A solution`,id:`a-solution`,children:_jsx(CodeBlock,{filename:`src/entrypoints/hello.ts`,numberOfLines:`28`,language:`typescript`,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:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`28`,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:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tryreason'`})]}),`\n`,_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\":`#9CDCFE`},children:` getDistance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '../actions/getDistance'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`interface`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` City`}),_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:`// ...`})}),`\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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` POST`}),_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:`// ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` cityInformation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reasonStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`City`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Tell me about \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--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:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cityInformation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`points_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_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:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cityInformation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`points_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_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:`#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:`point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`distance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_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:` /* 👆 Added this new check to make sure`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` that we **only** calculate the distance`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` if this point_of_interest has not calculated`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` its distance before. */`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ...`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` point_of_interest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`distance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getDistance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`poiLatitude`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`poiLongitude`}),_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`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},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(_components.hr,{}),`\n`,_jsx(Heading,{level:`1`,id:`conclusion`,children:`Conclusion`}),`\n`,_jsxs(_components.p,{children:[`This was the RΞASON quickstart, in it you learnt the fundamentals behind RΞASON. There’s `,_jsx(_components.strong,{children:`a lot`}),` more to learn though — agents \u0026 observability are two key features of RΞASON.`]}),`\n`,_jsx(_components.p,{children:`Be sure to save the code you created during this walkthrough as it will be utilized during the rest of RΞASON’s docs.`}),`\n`,_jsxs(_components.p,{children:[`Next we’ll go in-depth about some of the fundamentals of RΞASON — starting with `,_jsx(_components.a,{href:`/docs/essentials/entrypoints`,children:`entrypoints`}),`.`]})]})}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":"Quickstart","description":"Learn the fundamentals in 10 minutes","href":"/docs/quickstart"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Installation","slug":"installation","depth":2,"children":[]},{"title":"Directory structure","slug":"directory-structure","depth":2,"children":[{"title":"File-based system","slug":"file-based-system","depth":3,"children":[]}]},{"title":"Running your app","slug":"running-your-app","depth":2,"children":[{"title":"Setting your API Key","slug":"setting-your-api-key","depth":3,"children":[]},{"title":"RΞASON Playground","slug":"rξason-playground","depth":3,"children":[]}]},{"title":"The basics","slug":"the-basics","depth":2,"children":[]},{"title":"Spicing it up","slug":"spicing-it-up","depth":1,"children":[{"title":"Extending City interface","slug":"extending-city-interface","depth":3,"children":[]},{"title":"Taking up a notch","slug":"taking-up-a-notch","depth":3,"children":[]},{"title":"Iterating through reasonStream()","slug":"iterating-through-reasonstream","depth":3,"children":[]},{"title":"Calling getDistance()","slug":"calling-getdistance","depth":3,"children":[]}]},{"title":"Bonus section: Observability","slug":"bonus-section-observability","depth":2,"children":[]},{"title":"Conclusion","slug":"conclusion","depth":1,"children":[]}],"codeExamples":{}},"jsLinks":[],"dynamicCss":".mint-flex {\n display: flex\n}\n.mint-w-full {\n width: 100%\n}\n.mint-max-w-\\[300px\\] {\n max-width: 300px\n}\n.mint-max-w-\\[350px\\] {\n max-width: 350px\n}\n.mint-justify-center {\n justify-content: center\n}","subdomain":"try-reason","siteName":"RΞASON","title":"Docs — RΞASON","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T00:42:24.655Z","originalFileLocation":"docs/quickstart.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"dark\";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=\"dark\"}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=\"Learn the fundamentals in 10 minutes\">\u003cmeta data-mint-head name=\"application-name\" content=\"RΞASON\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_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/try-reason/7WV4V3yRT-Bn79oR/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Docs — RΞASON\">\u003cmeta data-mint-head property=\"og:description\" content=\"RΞASON is a Typescript framework for building great LLM apps.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"RΞASON\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.tryreason.dev/docs/quickstart\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://try-reason.mintlify.app/images/og3.jpg\">\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=\"Docs — RΞASON\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"RΞASON is a Typescript framework for building great LLM apps.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://try-reason.mintlify.app/images/og3.jpg\">\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/try-reason/7WV4V3yRT-Bn79oR/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"RΞASON\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#000\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.tryreason.dev/docs/quickstart\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/quickstart.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.tryreason.dev/#organization\",\"name\":\"RΞASON\",\"url\":\"https://docs.tryreason.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/try-reason/0KnLlcIRItMRUBUT/logo/light.svg?fit=max\u0026auto=format\u0026n=0KnLlcIRItMRUBUT\u0026q=85\u0026s=2ec9be69097e5b8cb8ddc734abf519ee\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.tryreason.dev#website\",\"name\":\"RΞASON\",\"url\":\"https://docs.tryreason.dev\",\"publisher\":{\"@id\":\"https://docs.tryreason.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.tryreason.dev/docs/quickstart#webpage\",\"url\":\"https://docs.tryreason.dev/docs/quickstart\",\"name\":\"Quickstart\",\"description\":\"Learn the fundamentals in 10 minutes\",\"dateModified\":\"2026-01-07T00:42:24.655Z\",\"isPartOf\":{\"@id\":\"https://docs.tryreason.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.tryreason.dev/docs/quickstart#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.tryreason.dev/docs/quickstart#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get Started\",\"item\":\"https://docs.tryreason.dev/docs/introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quickstart\",\"item\":\"https://docs.tryreason.dev/docs/quickstart\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.tryreason.dev/docs/quickstart#article\",\"headline\":\"Quickstart\",\"name\":\"Quickstart\",\"description\":\"Learn the fundamentals in 10 minutes\",\"url\":\"https://docs.tryreason.dev/docs/quickstart\",\"mainEntityOfPage\":{\"@id\":\"https://docs.tryreason.dev/docs/quickstart#webpage\"},\"image\":\"https://docs.tryreason.dev/images/og3.jpg\",\"dateModified\":\"2026-01-07T00:42:24.655Z\",\"publisher\":{\"@id\":\"https://docs.tryreason.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.tryreason.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"RΞASON\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"RΞASON","nav":{"global":{"anchors":[{"anchor":"Community","href":"https://discord.gg/BnFdtPw6","icon":"discord"},{"anchor":"Blog","href":"https://tryreason.dev/blog","icon":"newspaper"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Get Started","pages":[{"title":"Introduction","description":"**RΞASON** is a _minimalistic_ Typescript framework for building great LLM apps","href":"/docs/introduction"},{"title":"Quickstart","href":"/docs/quickstart"}]},{"group":"Essentials","pages":[{"title":"Entrypoints","description":"An entrypoint is an endpoint an user can request","href":"/docs/essentials/entrypoints"},{"title":"reason()","href":"/docs/essentials/reason"},{"title":"reasonStream()","href":"/docs/essentials/reason-stream"},{"title":"Agents","href":"/docs/essentials/agents"},{"title":"Observability","href":"/docs/essentials/observability"}]},{"group":"General","pages":[{"title":"Javascript client library","href":"/docs/general/js-lib"},{"title":"React library","href":"/docs/general/react-lib"}]}]}]},"basePath":"","title":"Docs — RΞASON","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":["07c022d89b","a74be98ba7","a9bb46feb3"],"chunks":["Frame-DXXFP6nH.js","DynamicMarkdown-B54_zNBF.js","zoom-image-lightbox-BG6oD64b.js","lightbox-handle-r17bVUz3.js","Markdown-DfhCTwyA.js","clsx-xpJZXxdP.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BTZUMDnx.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-DqdKa2R4.js"]}