-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update chat example to use newer template (#10)
* Update chat example to use newer template * Replace JS code with TS code in example README
- Loading branch information
1 parent
323ecde
commit 2c262ff
Showing
15 changed files
with
315 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
direction: right | ||
classes: { | ||
substrate: { | ||
label: "substrate" | ||
style: { | ||
font: mono | ||
font-color: gray | ||
font-size: 20 | ||
stroke: gray | ||
stroke-dash: 1 | ||
fill: "transparent" | ||
border-radius: 16 | ||
} | ||
} | ||
node: { | ||
style: { | ||
font: mono | ||
font-size: 24 | ||
stroke-width: 2 | ||
fill: transparent | ||
stroke: gray | ||
border-radius: 16 | ||
stroke-dash: 1 | ||
3d: true | ||
} | ||
} | ||
edge: { | ||
style: { | ||
stroke: "#000" | ||
stroke-dash: 2 | ||
} | ||
} | ||
} | ||
|
||
substrate.class: substrate | ||
substrate.a.class: node | ||
substrate.b.class: node | ||
substrate.c.class: node | ||
substrate.a.label: heuristic | ||
substrate.b.label: symbolic | ||
substrate.c.label: computation | ||
substrate.a->substrate.c { class: edge } | ||
substrate.b->substrate.c { class: edge } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# python generated files | ||
__pycache__/ | ||
*.py[oc] | ||
build/ | ||
dist/ | ||
wheels/ | ||
*.egg-info | ||
|
||
# venv | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Substrate Example Templates in Python | ||
|
||
This is a Substrate example template written in Python. To run this example, | ||
|
||
```bash | ||
# Set your API key as an environment variable. | ||
# Get one here https://www.substrate.run/dashboard/keys if this is your first time. | ||
export SUBSTRATE_API_KEY=<your Substrate API key> | ||
|
||
# Navigate to the python example directory. | ||
cd python | ||
``` | ||
|
||
To run the example with Poetry (default), run the following. | ||
|
||
```bash | ||
poetry install | ||
poetry run main | ||
``` | ||
|
||
To run the example with Rye, comment out the Poetry sections and uncomment the Rye sections in `pyproject.toml` and run the following. | ||
|
||
```bash | ||
rye sync | ||
rye run main | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
[virtualenvs] | ||
in-project = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
[project] | ||
name = "chat-with-an-llm" | ||
name = "template" | ||
version = "0.1.0" | ||
description = "" | ||
authors = [{ name = "Hanwen Wu", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
||
requires-python = ">= 3.9" | ||
dependencies = ["substrate"] | ||
|
||
|
@@ -28,7 +32,7 @@ build-backend = "poetry.core.masonry.api" | |
name = "template" | ||
version = "0.1.0" | ||
description = "" | ||
authors = [] | ||
authors = ["Hanwen Wu <[email protected]>"] | ||
readme = "README.md" | ||
|
||
packages = [{ include = "python", from = "src" }] | ||
|
@@ -42,7 +46,7 @@ ruff = "^0.6.1" | |
marimo = "^0.8.0" | ||
|
||
[tool.poetry.scripts] | ||
main = "example:main" | ||
main = "python.example:main" | ||
|
||
|
||
########################### | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,4 @@ def main(): | |
|
||
if __name__ == "__main__": | ||
main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Substrate Example Templates in Typescript | ||
|
||
This is a Substrate example template written in Typescript. To run this example, | ||
|
||
```bash | ||
# Set your API key as an environment variable. | ||
# Get one here https://www.substrate.run/dashboard/keys if this is your first time. | ||
export SUBSTRATE_API_KEY=<your Substrate API key> | ||
|
||
# Navigate to the python example directory. | ||
cd typescript | ||
``` | ||
|
||
To run the example with tsx (default), run the following. | ||
|
||
```bash | ||
npx tsx ./example.ts | ||
|
||
# Or you can use the package.json scripts | ||
npm run start | ||
``` | ||
|
||
To run the example with Deno, uncomment the Deno sections in `example.ts` and | ||
run the following. | ||
|
||
```bash | ||
deno run ./example.ts | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
{ | ||
"name": "chat-with-an-llm", | ||
"name": "substrate-example", | ||
"version": "1.0.0", | ||
"private": "true", | ||
"main": "example.ts", | ||
"type": "module", | ||
"scripts": { | ||
"start": "node main.js" | ||
"start": "npx tsx example.ts", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"substrate": "^120240617.1.9" | ||
"substrate": "^120240617" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22", | ||
"typescript": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleDetection": "force", | ||
"module": "Preserve", | ||
"resolveJsonModule": true, | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"isolatedModules": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"moduleResolution": "node", | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"plugins": [{ "name": "next" }], | ||
"paths": { "@/*": ["./*"] } | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |