Skip to content

Commit

Permalink
docs: Rolls back migration of these samples to the the Firebase repo. (
Browse files Browse the repository at this point in the history
…#1564)

* docs: Rolls back migration of these samples to the the Firebase repo.

* Update README.md

Results of running pnpm format

* Delete .idea directory
  • Loading branch information
thedmail authored Jan 16, 2025
1 parent 5d24e23 commit 10412f8
Show file tree
Hide file tree
Showing 118 changed files with 5,021 additions and 2 deletions.
12 changes: 10 additions & 2 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Genkit samples

These samples have migrated to the Firebase
[`quickstart-nodejs` repo](https://github.com/firebase/quickstart-nodejs).
Take a look at some samples of Genkit in use:

- [js-coffee-shop](js-coffee-shop/): "AI barista", demonstrating simple
LLM usage
- [js-menu](js-menu/): Progressively more sophisticated versions of a
menu understanding app
- [chatbot](chatbot/): A simple chatbot with a JavaScript frontend
- [js-angular](js-angular/): Demo of streaming to an Angular frontend
- [js-schoolAgent](js-schoolAgent/): A simple school assistant system with a routing agent and specialized agents
- [prompts](prompts/): Shows off several prompting techniques
1 change: 1 addition & 0 deletions samples/chatbot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
35 changes: 35 additions & 0 deletions samples/chatbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Chatbot

This is a simple chatbot. You can pick which model to use.

Prerequisite

- install Genkit (`npm i -g genkit`)
- Google Cloud project with Vertex AI API enabled (https://pantheon.corp.google.com/apis/library/aiplatform.googleapis.com)
- gcloud CLI installed (https://cloud.google.com/sdk/docs/install-sdk)
- to use Llama 3.1 405b enable it in the Vertex AI [Model Garden](https://console.cloud.google.com/vertex-ai/publishers/meta/model-garden/llama3-405b-instruct-maas)

The sample is using Vertex AI, so you'll need to auth:

```bash
gcloud auth login
gcloud auth application-default login --project YOUR_PROJECT
```

Clone this code

```
git clone https://github.com/firebase/genkit
cd genkit/samples/chatbot
```

Install deps and run the chatbot app

```bash
npm run setup
npm start
```

Point your browser to http://localhost:4200/

Inspect runs in http://localhost:4000/
10 changes: 10 additions & 0 deletions samples/chatbot/eval.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"conversationId": "1234",
"prompt": "tell me a joke"
},
{
"conversationId": "2345",
"prompt": "wtite a python program that prints out weather for the current location"
}
]
16 changes: 16 additions & 0 deletions samples/chatbot/genkit-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions samples/chatbot/genkit-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
27 changes: 27 additions & 0 deletions samples/chatbot/genkit-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# GenkitApp

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.2.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
105 changes: 105 additions & 0 deletions samples/chatbot/genkit-app/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"genkit-app": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/genkit-app",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"@angular/material/prebuilt-themes/azure-blue.css",
"src/styles.scss",
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
],
"scripts": [
"node_modules/prismjs/prism.js",
"node_modules/prismjs/components/prism-csharp.min.js",
"node_modules/prismjs/components/prism-css.min.js",
"node_modules/prismjs/plugins/line-highlight/prism-line-highlight.js"
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "genkit-app:build:production"
},
"development": {
"buildTarget": "genkit-app:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"@angular/material/prebuilt-themes/azure-blue.css",
"src/styles.scss"
],
"scripts": []
}
}
}
}
}
}
44 changes: 44 additions & 0 deletions samples/chatbot/genkit-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "genkit-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/cdk": "^18.0.1",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/material": "^18.0.1",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"marked": "^12.0.2",
"ngx-markdown": "^18.0.0",
"prismjs": "^1.29.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3",
"genkit": "^0.9.0-rc || ^0.9"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.2",
"@angular/cli": "^18.0.2",
"@angular/compiler-cli": "^18.0.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.2"
}
}
Binary file added samples/chatbot/genkit-app/public/favicon.ico
Binary file not shown.
36 changes: 36 additions & 0 deletions samples/chatbot/genkit-app/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
Copyright 2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<div class="wrapper">
<mat-toolbar color="secondary">
<a routerLink="/" class="home-link">Chat with an LLM</a>

<mat-tab-nav-panel #tabPanel></mat-tab-nav-panel>

<div class="flex-spacer"></div>
<a
mat-icon-button
href="https://firebase.google.com/docs/genkit"
matTooltip="Docs"
target="_blank">
<mat-icon>description</mat-icon>
</a>
</mat-toolbar>

<article>
<router-outlet></router-outlet>
</article>
</div>
Loading

0 comments on commit 10412f8

Please sign in to comment.