Skip to content

Commit

Permalink
Merge pull request #44 from mastra-ai/taofeeq/futr-754-create-eval-fo…
Browse files Browse the repository at this point in the history
…r-bird-checker

Taofeeq/futr 754 create eval for bird checker
  • Loading branch information
Taofeeq-deru authored Nov 12, 2024
2 parents e7f0f2a + ff6b37c commit d71b1e0
Show file tree
Hide file tree
Showing 41 changed files with 6,648 additions and 18 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/eval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run evals

on:
push:
# paths: "/bird-checker-with-eval"

permissions:
pull-requests: write
contents: read

jobs:
eval:
name: Run evals
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Install Dependencies
id: install
run: pnpm install

- name: Run Evals
uses: braintrustdata/eval-action@v1
with:
api_key: ${{ secrets.BRAINTRUST_API_KEY }}
runtime: node
root: bird-checker-with-eval/src/lib/evals
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.env.*
7 changes: 7 additions & 0 deletions bird-checker-with-eval/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NEXT_PUBLIC_UNSPLASH_ACCESS_KEY=
INNGEST_URL=
DB_URL=
APP_URL=
MASTRA_ADMIN_PORT=
ANTHROPIC_API_KEY=
BRAINTRUST_API_KEY=
3 changes: 3 additions & 0 deletions bird-checker-with-eval/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
45 changes: 45 additions & 0 deletions bird-checker-with-eval/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env files (can opt-in for commiting if needed)
.env
.env.local
.env.development

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# mastra
.mastra/
Empty file.
36 changes: 36 additions & 0 deletions bird-checker-with-eval/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
21 changes: 21 additions & 0 deletions bird-checker-with-eval/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
1 change: 1 addition & 0 deletions bird-checker-with-eval/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "@prisma/nextjs-monorepo-workaround-plugin";
57 changes: 57 additions & 0 deletions bird-checker-with-eval/mastra.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { getImageMetadataFromClaude, getRandomImage } from "@/lib/mastra/system-apis";
import { Config, LogLevel } from "@mastra/core";
import { z } from "zod";

export const config: Config = {
name: "bird-checker-with-eval",
integrations: [],
db: {
provider: "postgres",
uri: process.env.DB_URL!
},

runner: {
provider: "inngest",
uri: process.env.INNGEST_URL!,
signingKey: process.env.INNGEST_SIGNING_KEY!,
eventKey: process.env.INNGEST_EVENT_KEY!
},
workflows: {
blueprintDirPath: "/mastra/blueprints",
systemEvents: {},
systemApis: [
{
type: "get_random_image",
label: "Get a random image from unsplash",
description: "Gets a random image from unsplash based on the selected option",
schema: z.object({
query: z.enum(["wildlife", "feathers", "flying", "birds"])
}),
executor: async ({ data }: { data: unknown }) => {
return getRandomImage(data as { query: string });
}
},
{
type: "get_image_metadata_from_claude",
label: "Get image metadata from claude",
description: "Get image metadata from claude",
schema: z.object({
imageUrl: z.string()
}),
executor: async ({ data }: { data: unknown }) => {
return getImageMetadataFromClaude(data as { imageUrl: string });
}
}
]
},
logs: {
provider: "FILE",
level: LogLevel.DEBUG
},
agents: {
agentDirPath: "/mastra/agents",
vectorProvider: []
},
systemHostURL: process.env.APP_URL!,
routeRegistrationPath: "/api/mastra"
};
27 changes: 27 additions & 0 deletions bird-checker-with-eval/mastra.docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
db:
image: postgres:13
container_name: 'bird-checker-db'
ports:
- '5434:5432'
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-mastra}
volumes:
- pgdata:/var/lib/postgresql/data

inngest:
container_name: 'bird-checker-inngest'
image: inngest/inngest:v0.27.0
ports:
- '8290:8288'
extra_hosts:
- 'host.docker.internal:host-gateway'
command:
- 'inngest'
- 'dev'
- '-u'
- 'http://host.docker.internal:3456/api/mastra/inngest, http://host.docker.internal:3000/api/mastra/inngest'
volumes:
pgdata:
27 changes: 27 additions & 0 deletions bird-checker-with-eval/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { NextConfig } from "next";
import { PrismaPlugin } from "@prisma/nextjs-monorepo-workaround-plugin";

const nextConfig: NextConfig = {
/* config options here */
images: {
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
port: "",
},
],
},
outputFileTracingIncludes: {
"**/*": ["./mastra/**/*"],
},
webpack: (config, { isServer }) => {
if (isServer) {
config.plugins = [...config.plugins, new PrismaPlugin()];
}

return config;
},
};

export default nextConfig;
46 changes: 46 additions & 0 deletions bird-checker-with-eval/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "bird-checker",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint",
"mastra:init": "pnpm dlx mastra init",
"mastra:dev": "pnpm dlx mastra dev",
"mastra:migrate": "pnpm dlx mastra migrate"
},
"dependencies": {
"@mastra/core": "^0.1.26",
"@prisma/client": "5.22.0",
"braintrust": "^0.0.168",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"next-themes": "^0.4.3",
"nuqs": "^2.1.1",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"sonner": "^1.7.0",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@prisma/nextjs-monorepo-workaround-plugin": "^5.22.0",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "15.0.2",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"packageManager": "[email protected]",
"engines": {
"pnpm": ">=9.7.0"
}
}
Loading

0 comments on commit d71b1e0

Please sign in to comment.