https://github.com/classfunc/gkh
Genkit code snippets
https://github.com/classfunc/gkh
Last synced: 8 months ago
JSON representation
Genkit code snippets
- Host: GitHub
- URL: https://github.com/classfunc/gkh
- Owner: ClassFunc
- Created: 2024-11-11T07:06:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-11T07:14:57.000Z (over 1 year ago)
- Last Synced: 2024-12-11T08:22:48.909Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 470 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GKH: Genkit helper
Imagine you have genkit, and the library helps you complete your ideas with code snippets.
## Main functions
- [x] [make:ai - make a genkit ai instance](#make:ai)
- [x] [add:getAllFlows - add code snippet to read all your structured flows](#add:getAllFlows)
- [x] [make:flow - make a flow](#make:flow)
- [x] [make:rag - make a rag (indexer & retriever)](#make:rag)
- [x] [make:tool - make a tool](#make:tool)
- [x] [make:prompt - make a prompt](#make:prompt)
- [x] [make:reranker - make a reranker](#make:reranker)
- [x] [docs:gen - generate openapi documents](#docs:gen)
- [x] [make:schema - make a schema](#make:schema)
## Usage
```shell
npx gkh
#or
npm i -g gkh
# then starting use `gkh` command on your root of genkit project or `functions` folder.
```
Note: If you are using genkit version < 1 (e.g:0.5 or 0.9), using gkh version 2:
```shell
npx gkh@2
```
### make:ai
```
Usage: gkh make:ai [options]
make a genkit ai instance
Options:
-p,--path [path] path for save ai instance (default: "src/ai/ai.ts")
-h, --help display help for command
```
### add:getAllFlows
```
Usage: gkh add:getAllFlows [options]
add code snippet to read all your structured flows
Options:
-t, --type [type] for 'functions' | 'api' (default: "api")
-h, --help display help for command
```
### make:flow
```
Usage: gkh make:flow [options]
make a flow
genkit docs: https://firebase.google.com/docs/genkit/flows
Arguments:
name name of flow, separated by / , e.g: users/list
Options:
-s, --stream [stream] flow is streaming or not (default: false)
-t, --type [type] supported 'defineFlow', 'onFlow','onCallGenkit' (default: "defineFlow")
-h, --help display help for command
```
### make:rag
```
Usage: gkh make:rag [options]
make a rag (indexer & retriever)
genkit docs: https://firebase.google.com/docs/genkit/rag
Arguments:
name rag name; e.g: menuQA
Options:
-t, --type [type] type of vectorstore; supported 'fs'('firestore'), 'simple','local', 'custom' (default: "simple")
-l, --limit [limit] retriever's limit (default: 5)
-c, --collection [collection] firestore collection (default: "yourFirestoreCollection")
--cf, --contentField [contentField] contentField (default: "contentField")
--vf, --vectorField [vectorField] vectorField; default: $contentField + '_' + embedder.name (default: "")
-h, --help display help for command
```
### make:tool
```
Usage: gkh make:tool [options]
make a tool
genkit docs: https://firebase.google.com/docs/genkit/tool-calling
Arguments:
name tool name
Options:
-d, --description [description] tool description (default: "useful for...")
-h, --help display help for command
```
### make:prompt
```
Usage: gkh make:prompt [options]
make a prompt
genkit docs: https://firebase.google.com/docs/genkit/dotprompt
Arguments:
name prompt name
Options:
-d, --description [description] prompt description (default: "")
-v, --variant [variant] variant (default: "")
-m, --model [model] model (default: "")
-h, --help display help for command
```
### make:reranker
```
Usage: gkh make:reranker [options]
make a reranker
genkit docs: https://firebase.google.com/docs/genkit/rag#rerankers_and_two-stage_retrieval
Arguments:
name reranker name
Options:
-k, --topK [topK] topK (default: 10)
-r, --ref [ref] reference of reranker (default: "vertexai/semantic-ranker-fast-004")
-h, --help display help for command
```
### docs:gen
```
Usage: gkh docs:gen [options]
generate openapi documents
Options:
-n, --name name of yaml file (default: "api")
-o, --out output docs directory (default: "./docs")
-e, --env-file env file path (default: ".env")
-h, --help display help for command
```
### make:schema
```
Usage: gkh make:schema [options]
make a schema
Arguments:
name name of schema , e.g: users
Options:
-j, --jsonPath from json path (default: "")
-c, --fromClipboard from clipboard's json value (default: false)
-h, --help display help for command
```
## FAQ:
- Q: I don't see any flows on Developer UI.
- A: run `gkh add:getAllFlows`
```
## Author:
ClassFunc Softwares JSC (https://classfunc.com)
## License:
MIT
```