-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19a7ae0
commit 05be989
Showing
8 changed files
with
164 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Pipes. | ||
PIPE_LESS_WORDY="" | ||
PIPE_LESS_WORDY_STREAM="" |
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,75 @@ | ||
# NPM # | ||
########## | ||
# Ignore all directories called node_modules in current folder and any subfolders. | ||
node_modules/ | ||
/node_modules/ | ||
|
||
# Packages # | ||
############ | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.bz2 | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
*.tgz | ||
*.map | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.sql | ||
*.env | ||
|
||
# OS generated files # | ||
###################### | ||
**.DS_Store* | ||
ehthumbs.db | ||
Icon? | ||
Thumbs.db | ||
._* | ||
**settings.dat* | ||
|
||
# Vim generated files # | ||
###################### | ||
*.un~ | ||
|
||
# SASS # | ||
########## | ||
**/.sass-cache | ||
**/.sass-cache/* | ||
**/.map | ||
|
||
# Composer # | ||
########## | ||
!assets/js/vendor/ | ||
wpcs/ | ||
/vendor/ | ||
|
||
# Bower # | ||
########## | ||
assets/bower_components/* | ||
|
||
# Codekit # | ||
########## | ||
/codekit-config.json | ||
*.codekit | ||
**.codekit-cache/* | ||
|
||
# Compiled Files and Build Dirs # | ||
########## | ||
/README.html | ||
|
||
# PhpStrom Project Files # | ||
.idea/ | ||
library/vendors/composer | ||
assets/img/.DS_Store | ||
|
||
# VSCode related files # | ||
# .vscode | ||
|
||
# Next.js | ||
.next |
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 @@ | ||
{ | ||
"bracketSpacing": false, | ||
"trailingComma": "all", | ||
"arrowParens": "avoid", | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"useTabs": true, | ||
"tabWidth": 4, | ||
"semi": 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'dotenv/config'; | ||
import {Pipe} from 'langbase'; | ||
|
||
// STREAM: OFF | ||
const pipeStreamOff = new Pipe({ | ||
apiKey: process.env.PIPE_LESS_WORDY!, | ||
}); | ||
|
||
const result = await pipeStreamOff.generateText({ | ||
messages: [{role: 'user', content: 'Who is an AI Engineer?'}], | ||
}); | ||
|
||
console.log('STEAM-OFF'); | ||
console.log(result.completion); | ||
|
||
// STREAM: ON | ||
const pipeStreaming = new Pipe({ | ||
apiKey: process.env.PIPE_LESS_WORDY_STREAM!, | ||
}); | ||
|
||
const stream = await pipeStreaming.streamText({ | ||
messages: [{role: 'user', content: 'Who is an AI Engineer?'}], | ||
}); | ||
|
||
console.log('\n'); | ||
console.log('STEAM-ON'); | ||
for await (const chunk of stream) { | ||
process.stdout.write(chunk.choices[0]?.delta?.content || ''); | ||
} |
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,17 @@ | ||
{ | ||
"name": "everything", | ||
"version": "0.0.1", | ||
"description": "Everything example", | ||
"type": "module", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npx tsx index.ts" | ||
}, | ||
"keywords": [], | ||
"author": "Ahmad Awais <[email protected]> (https://twitter.com/MrAhmadAwais)", | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
"dotenv": "^16.4.5", | ||
"langbase": "^0.0.0" | ||
} | ||
} |
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,11 @@ | ||
# Everything Example | ||
|
||
Here's a kitchen sink example that does everything. | ||
|
||
```sh | ||
# Make sure to copy .env.example file and create .env file with all the keys in it | ||
cp .env.example .env | ||
|
||
# Then test. | ||
npm test | ||
``` |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.