-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more work on getting started & workflow docs
- Loading branch information
Tony Worm
committed
May 26, 2024
1 parent
86fe204
commit 2be9007
Showing
12 changed files
with
313 additions
and
15 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,32 @@ | ||
print consolidated CUE definitions | ||
|
||
Usage: | ||
hof def [flags] | ||
|
||
Flags: | ||
-a, --attributes diplay field attributes | ||
-C, --comments include comments in output | ||
-e, --expression stringArray evaluate these expressions only | ||
-h, --help help for def | ||
--inline-imports expand references to non-core imports | ||
--list concatenate multiple objects into a list | ||
--out string output data format, when detection does not work | ||
-o, --outfile string filename or - for stdout with optional file prefix | ||
--simplify simplify CUE statements where possible | ||
|
||
Global Flags: | ||
-E, --all-errors print all available errors | ||
-i, --ignore-errors turn off output and assume defaults at prompts | ||
-D, --include-data auto include all data files found with cue files | ||
-V, --inject-env inject all ENV VARs as default tag vars | ||
-I, --input stringArray extra data to unify into the root value | ||
-p, --package string the Cue package context to use during execution | ||
-l, --path stringArray CUE expression for single path component when placing data files | ||
-q, --quiet turn off output and assume defaults at prompts | ||
-d, --schema stringArray expression to select schema to apply to data files | ||
--stats print generator statistics | ||
-0, --stdin-empty A flag that ensure stdin is zero and does not block | ||
-t, --tags stringArray @tags() to be injected into CUE code | ||
-U, --user-files stringArray file globs to embed into the root value (<cue-path>=<file-glob>), use % as slash to trim before | ||
-v, --verbosity int set the verbosity of output | ||
--with-context add extra context for data files, usable in the -l/path flag |
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,7 @@ | ||
unknown command "dev" for "hof" | ||
|
||
Did you mean this? | ||
gen | ||
def | ||
vet | ||
|
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,41 @@ | ||
evaluate and print CUE configuration | ||
|
||
Usage: | ||
hof eval [flags] | ||
|
||
Flags: | ||
-a, --all show optional and hidden fields | ||
-A, --attributes display field attributes | ||
-C, --comments include comments in output | ||
-c, --concrete require the evaluation to be concrete | ||
--defaults use default values if not set | ||
-S, --definitions display defintions (default true) | ||
--escape use HTLM escaping | ||
-e, --expression stringArray evaluate these expressions only | ||
--final finalize the value (default true) | ||
-h, --help help for eval | ||
-H, --hidden display hidden fields | ||
--inline-imports expand references to non-core imports | ||
--list concatenate multiple objects into a list | ||
-O, --optional display optional fields | ||
--out string output data format, when detection does not work | ||
-o, --outfile string filename or - for stdout with optional file prefix | ||
--resolve resolve references in value | ||
--simplify simplify CUE statements where possible | ||
|
||
Global Flags: | ||
-E, --all-errors print all available errors | ||
-i, --ignore-errors turn off output and assume defaults at prompts | ||
-D, --include-data auto include all data files found with cue files | ||
-V, --inject-env inject all ENV VARs as default tag vars | ||
-I, --input stringArray extra data to unify into the root value | ||
-p, --package string the Cue package context to use during execution | ||
-l, --path stringArray CUE expression for single path component when placing data files | ||
-q, --quiet turn off output and assume defaults at prompts | ||
-d, --schema stringArray expression to select schema to apply to data files | ||
--stats print generator statistics | ||
-0, --stdin-empty A flag that ensure stdin is zero and does not block | ||
-t, --tags stringArray @tags() to be injected into CUE code | ||
-U, --user-files stringArray file globs to embed into the root value (<cue-path>=<file-glob>), use % as slash to trim before | ||
-v, --verbosity int set the verbosity of output | ||
--with-context add extra context for data files, usable in the -l/path flag |
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,31 @@ | ||
output data in a standard format | ||
|
||
Usage: | ||
hof export [flags] | ||
|
||
Flags: | ||
-C, --comments include comments in output | ||
--escape use HTLM escaping | ||
-e, --expression stringArray evaluate these expressions only | ||
-h, --help help for export | ||
--list concatenate multiple objects into a list | ||
--out string output data format, when detection does not work | ||
-o, --outfile string filename or - for stdout with optional file prefix | ||
--simplify simplify CUE statements where possible | ||
|
||
Global Flags: | ||
-E, --all-errors print all available errors | ||
-i, --ignore-errors turn off output and assume defaults at prompts | ||
-D, --include-data auto include all data files found with cue files | ||
-V, --inject-env inject all ENV VARs as default tag vars | ||
-I, --input stringArray extra data to unify into the root value | ||
-p, --package string the Cue package context to use during execution | ||
-l, --path stringArray CUE expression for single path component when placing data files | ||
-q, --quiet turn off output and assume defaults at prompts | ||
-d, --schema stringArray expression to select schema to apply to data files | ||
--stats print generator statistics | ||
-0, --stdin-empty A flag that ensure stdin is zero and does not block | ||
-t, --tags stringArray @tags() to be injected into CUE code | ||
-U, --user-files stringArray file globs to embed into the root value (<cue-path>=<file-glob>), use % as slash to trim before | ||
-v, --verbosity int set the verbosity of output | ||
--with-context add extra context for data files, usable in the -l/path flag |
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,35 @@ | ||
validate data with CUE | ||
|
||
Usage: | ||
hof vet [flags] | ||
|
||
Flags: | ||
-A, --attributes display field attributes | ||
-C, --comments include comments in output | ||
-c, --concrete require the evaluation to be concrete | ||
-S, --definitions display defintions (default true) | ||
-e, --expression stringArray evaluate these expressions only | ||
-h, --help help for vet | ||
-H, --hidden display hidden fields | ||
--list concatenate multiple objects into a list | ||
-O, --optional display optional fields | ||
--out string output data format, when detection does not work | ||
-o, --outfile string filename or - for stdout with optional file prefix | ||
--simplify simplify CUE statements where possible | ||
|
||
Global Flags: | ||
-E, --all-errors print all available errors | ||
-i, --ignore-errors turn off output and assume defaults at prompts | ||
-D, --include-data auto include all data files found with cue files | ||
-V, --inject-env inject all ENV VARs as default tag vars | ||
-I, --input stringArray extra data to unify into the root value | ||
-p, --package string the Cue package context to use during execution | ||
-l, --path stringArray CUE expression for single path component when placing data files | ||
-q, --quiet turn off output and assume defaults at prompts | ||
-d, --schema stringArray expression to select schema to apply to data files | ||
--stats print generator statistics | ||
-0, --stdin-empty A flag that ensure stdin is zero and does not block | ||
-t, --tags stringArray @tags() to be injected into CUE code | ||
-U, --user-files stringArray file globs to embed into the root value (<cue-path>=<file-glob>), use % as slash to trim before | ||
-v, --verbosity int set the verbosity of output | ||
--with-context add extra context for data files, usable in the -l/path flag |
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,80 @@ | ||
package examples | ||
|
||
import "strings" | ||
|
||
vertex_chat: { | ||
@flow() // define a flow | ||
|
||
steps: { | ||
|
||
// task: get auth from external command | ||
gcp: { | ||
@task(os.Exec) | ||
cmd: ["gcloud", "auth", "print-access-token"] | ||
stdout: string | ||
key: strings.TrimSpace(stdout) | ||
} | ||
|
||
// task: api call via reusable task | ||
call: _gemini & { | ||
apikey: gcp.key | ||
|
||
msg: "What is the CUE language?" | ||
|
||
resp: body: _ | ||
} | ||
|
||
// task: print text to std output | ||
out: { | ||
@task(os.Stdout) | ||
text: call.final.text | ||
} | ||
|
||
} | ||
} | ||
|
||
// reusable task | ||
_gemini: { | ||
@task(api.Call) | ||
|
||
model: string | *"gemini-1.0-pro-002:generateContent" | ||
|
||
msg: string | ||
apikey: string | ||
prompt: string | *"You are a model which is direct and concise when responding." | ||
|
||
req: { | ||
host: "https://us-central1-aiplatform.googleapis.com" | ||
path: "/v1/projects/hof-io--develop/locations/us-central1/publishers/google/models/\(model)" | ||
headers: { | ||
"Content-Type": "application/json" | ||
Authorization: "Bearer \(apikey)" | ||
} | ||
data: { | ||
systemInstruction: { | ||
role: "MODEL" | ||
parts: [{ | ||
text: prompt | ||
}] | ||
} | ||
|
||
contents: [{ | ||
role: "USER" | ||
parts: [{ | ||
text: msg | ||
}] | ||
}] | ||
} | ||
method: "POST" | ||
} | ||
|
||
resp: { | ||
body: _ | ||
} | ||
|
||
// task-local ETL | ||
final: { | ||
cand: resp.body.candidates[0] | ||
text: cand.content.parts[0].text | ||
} | ||
} |
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
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
Oops, something went wrong.