Skip to content

Commit

Permalink
Rename attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
pamella committed Oct 2, 2024
1 parent e333115 commit b670daf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
33 changes: 16 additions & 17 deletions example/assets/js/components/TourGuide/TourGuide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import {
Title,
} from "@mantine/core";
import { notifications } from "@mantine/notifications";
import { IconLocation, IconMap2 } from "@tabler/icons-react";

interface Attraction {
attraction_name: string;
attraction_description: string;
attraction_url: string;
name: string;
description: string;
}

export function TourGuide() {
Expand Down Expand Up @@ -83,7 +83,7 @@ export function TourGuide() {
Tour Guide
</Title>

<Group justify="left" align="flex-end" my="lg">
<Group justify="left" align="flex-end" mb="xl">
<TextInput
required
label="Latitude"
Expand All @@ -96,17 +96,15 @@ export function TourGuide() {
value={longitude}
onChange={(e) => setLongitude(e.target.value)}
/>
<Button onClick={findAttractions}>Guide Me!</Button>
<Button
leftSection={<IconMap2 size={18} stroke={1.5} />}
onClick={findAttractions}
>
Guide Me!
</Button>
</Group>

<Flex
gap="md"
justify="center"
align="flex-start"
direction="row"
wrap="wrap"
miw={460}
>
<Flex gap="md" align="flex-start" direction="row" wrap="wrap" miw={460}>
{attractions.map((attraction, index) => (
<Card
key={index}
Expand All @@ -116,18 +114,19 @@ export function TourGuide() {
radius="md"
withBorder
>
<Text fw={500} size="lg" mb="xs">
{attraction.attraction_name}
<Text fw={500} size="lg" mt="md" mb="xs">
{attraction.name}
</Text>
<Text size="sm" c="dimmed" mb="md">
{attraction.attraction_description}
{attraction.description}
</Text>
<Button
component="a"
href={`https://www.google.com/maps/search/?api=1&query=${attraction.attraction_name}`}
href={`https://www.google.com/maps/search/?api=1&query=${attraction.name}`}
target="_blank"
rel="noopener noreferrer"
variant="light"
leftSection={<IconLocation size={18} stroke={1.5} />}
>
View on Google Maps
</Button>
Expand Down
9 changes: 3 additions & 6 deletions example/tour_guide/ai_assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@


class Attraction(BaseModel):
attraction_name: str = Field(description="The name of the attraction in english")
attraction_description: str = Field(
name: str = Field(description="The name of the attraction in english")
description: str = Field(
description="The description of the attraction, provide information in an entertaining way"
)
attraction_url: str = Field(
description="The URL of the attraction, keep empty if you don't have this information"
)


class TourGuide(BaseModel):
Expand All @@ -31,7 +28,7 @@ class TourGuideAIAssistant(AIAssistant):
"Only include in your response the items that are relevant to a tourist visiting the area. "
"Only call the find_nearby_attractions tool once. "
)
model = "gpt-4o-2024-08-06"
model = "gpt-4o-mini"
structured_output = TourGuide

def get_instructions(self):
Expand Down

0 comments on commit b670daf

Please sign in to comment.