Skip to content

Commit

Permalink
Course crafter (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mearman authored Dec 23, 2023
2 parents caf37d5 + 70a1db8 commit 7daa86d
Show file tree
Hide file tree
Showing 34 changed files with 1,711 additions and 51 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"dependencies": {
"@exadev/breadboard-kits": "^0.8.2",
"@google-labs/breadboard": "^0.5.1"
"@exadev/breadboard-kits": "^0.9.0",
"@google-labs/breadboard": "^0.6.0"
},
"devDependencies": {
"@types/node": "^20.9.3",
"@types/node": "^20.10.4",
"tsx": "^4.6.2",
"typescript": "^5.3.2"
"typescript": "^5.3.3"
},
"engines": {
"node": ">=19"
Expand Down
18 changes: 18 additions & 0 deletions samples/CourseCrafter/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
24 changes: 24 additions & 0 deletions samples/CourseCrafter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions samples/CourseCrafter/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 21.4.0
228 changes: 228 additions & 0 deletions samples/CourseCrafter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# title

```mermaid
%%{init: 'themeVariables': { 'fontFamily': 'Fira Code, monospace' }}%%
graph TD;
promptDetails[/"input <br> id='promptDetails'"/]:::input -- "template->template" --> claudePromptConstructor["template <br> id='claudePromptConstructor'"]
blogDetails[/"input <br> id='blogDetails'"/]:::input -- "url->url" --> getBlogContents["getBlogContentForTask <br> id='getBlogContents'"]
taskDetails[/"input <br> id='taskDetails'"/]:::input -- "model->model" --> getBlogContents["getBlogContentForTask <br> id='getBlogContents'"]
taskDetails[/"input <br> id='taskDetails'"/]:::input -- "task->task" --> getBlogContents["getBlogContentForTask <br> id='getBlogContents'"]
getBlogContents["getBlogContentForTask <br> id='getBlogContents'"] -- "blogContent->input" --> summaryLanguageModel["pipeline <br> id='summaryLanguageModel'"]
getBlogContents["getBlogContentForTask <br> id='getBlogContents'"] -- "model->model" --> summaryLanguageModel["pipeline <br> id='summaryLanguageModel'"]
getBlogContents["getBlogContentForTask <br> id='getBlogContents'"] -- "task->task" --> summaryLanguageModel["pipeline <br> id='summaryLanguageModel'"]
getBlogContents["getBlogContentForTask <br> id='getBlogContents'"] -- "blogContent->blogContent" --> claudePromptConstructor["template <br> id='claudePromptConstructor'"]
summaryLanguageModel["pipeline <br> id='summaryLanguageModel'"] -- "output->summary" --> claudePromptConstructor["template <br> id='claudePromptConstructor'"]
getBlogContents["getBlogContentForTask <br> id='getBlogContents'"] -- "blogContent->blogContent" --> outputCollector{{"output <br> id='outputCollector'"}}:::output
summaryLanguageModel["pipeline <br> id='summaryLanguageModel'"] -- "output->blogSummary" --> outputCollector{{"output <br> id='outputCollector'"}}:::output
secrets1("secrets <br> id='secrets-1'"):::secrets -- "CLAUDE_KEY->apiKey" --> claudeAPI["generateCompletion <br> id='claudeAPI'"]
claudePromptConstructor["template <br> id='claudePromptConstructor'"] -- "string->userQuestion" --> claudeAPI["generateCompletion <br> id='claudeAPI'"]
claudePromptConstructor["template <br> id='claudePromptConstructor'"] -- "string->userQuestion" --> outputCollector{{"output <br> id='outputCollector'"}}:::output
claudeAPI["generateCompletion <br> id='claudeAPI'"] -- "completion->claudeResponse" --> outputCollector{{"output <br> id='outputCollector'"}}:::output
classDef default stroke:#ffab40,fill:#fff2ccff,color:#000
classDef input stroke:#3c78d8,fill:#c9daf8ff,color:#000
classDef output stroke:#38761d,fill:#b6d7a8ff,color:#000
classDef passthrough stroke:#a64d79,fill:#ead1dcff,color:#000
classDef slot stroke:#a64d79,fill:#ead1dcff,color:#000
classDef config stroke:#a64d79,fill:#ead1dcff,color:#000
classDef secrets stroke:#db4437,fill:#f4cccc,color:#000
classDef slotted stroke:#a64d79
```

```json
{
"title": "CourseCrafter",
"edges": [
{
"from": "promptDetails",
"to": "claudePromptConstructor",
"out": "template",
"in": "template"
},
{
"from": "blogDetails",
"to": "getBlogContents",
"out": "url",
"in": "url"
},
{
"from": "taskDetails",
"to": "getBlogContents",
"out": "model",
"in": "model"
},
{
"from": "taskDetails",
"to": "getBlogContents",
"out": "task",
"in": "task"
},
{
"from": "getBlogContents",
"to": "summaryLanguageModel",
"out": "blogContent",
"in": "input"
},
{
"from": "getBlogContents",
"to": "summaryLanguageModel",
"out": "model",
"in": "model"
},
{
"from": "getBlogContents",
"to": "summaryLanguageModel",
"out": "task",
"in": "task"
},
{
"from": "getBlogContents",
"to": "claudePromptConstructor",
"out": "blogContent",
"in": "blogContent"
},
{
"from": "summaryLanguageModel",
"to": "claudePromptConstructor",
"out": "output",
"in": "summary"
},
{
"from": "getBlogContents",
"to": "outputCollector",
"out": "blogContent",
"in": "blogContent"
},
{
"from": "summaryLanguageModel",
"to": "outputCollector",
"out": "output",
"in": "blogSummary"
},
{
"from": "secrets-1",
"to": "claudeAPI",
"out": "CLAUDE_KEY",
"in": "apiKey"
},
{
"from": "claudePromptConstructor",
"to": "claudeAPI",
"out": "string",
"in": "userQuestion"
},
{
"from": "claudePromptConstructor",
"to": "outputCollector",
"out": "string",
"in": "userQuestion"
},
{
"from": "claudeAPI",
"to": "outputCollector",
"out": "completion",
"in": "claudeResponse"
}
],
"nodes": [
{
"id": "blogDetails",
"type": "input",
"configuration": {
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"title": "Text",
"description": "urls"
}
}
}
}
},
{
"id": "promptDetails",
"type": "input",
"configuration": {
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"title": "Text",
"description": "urls"
}
}
}
}
},
{
"id": "taskDetails",
"type": "input",
"configuration": {
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"title": "Text",
"description": "model and task"
}
}
}
}
},
{
"id": "getBlogContents",
"type": "getBlogContentForTask"
},
{
"id": "summaryLanguageModel",
"type": "pipeline"
},
{
"id": "claudePromptConstructor",
"type": "template",
"configuration": {
"template": "Based on this summary and original text, give me code sample on how to achieve the discussed topic. Output result in markdown format, do not include the summary text in the output: /n{{summary}}/nthe original text is the following: /n{{blogContent}}"
}
},
{
"id": "outputCollector",
"type": "output"
},
{
"id": "secrets-1",
"type": "secrets",
"configuration": {
"0": "CLAUDE_API_KEY"
}
},
{
"id": "claudeAPI",
"type": "generateCompletion",
"configuration": {
"model": "claude-2",
"url": "https://api.anthropic.com/v1/complete"
}
}
],
"kits": [
{
"url": "npm@exadev/breadboard-kits/CourseCrafter"
},
{
"url": "npm:@xenova/transformers"
},
{
"url": "npm:@paulkinlan/claude-breadboard-kit"
},
{
"url": "npm:@exadev/breadboard-kits/kits/StringKit"
},
{
"url": "npm:@google-labs/llm-starter"
}
]
}
```
13 changes: 13 additions & 0 deletions samples/CourseCrafter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit 7daa86d

Please sign in to comment.