-
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.
* Extract default openai-request to a library. * Run claude somehow. * Move to "shared". * Run claude test. * Upgrade jsonnet package to support "files". * Pass Claude test. * Commit missing boilerplate files. * Fine-tune paths. * Openai template: use the library. * Move openai document template to the library. * Mass-test. * Describe how to run using jsonnet command line. * Make a distro with the lib and anthropic. * Update example of using jsonnet package. * Upgrade version in apis package. * Pass the tests. * Operative adds. * Lint. * Pass the test. * Lint. * Add note about template loading in nodejs. * Build new "tplfa" package. * `loadTemplate`: use the path to the template, not a name. * Use "loadTemplate" from the library. * Get a response from openai. * Add Claude document template. * Make dist for APIs. * Prepare "jsonnet" for release. * Mass-deps in "apis". * Release "apis". * Release "tplfa".
- Loading branch information
Showing
57 changed files
with
1,967 additions
and
127 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 @@ | ||
node_modules |
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,13 +1,37 @@ | ||
LIB_FILES :=$(wildcard lib/*.jsonnet) | ||
|
||
OPENAI_FILES := $(wildcard openai/lib/*.jsonnet) \ | ||
$(wildcard openai/fixture/*.json) | ||
|
||
SCHEMA_FILES := $(wildcard schemas/*.json) | ||
|
||
ALL_FILES := $(OPENAI_FILES) $(SCHEMA_FILES) | ||
ANTHROPIC_FILES := $(wildcard anthropic/lib/*.jsonnet) | ||
|
||
DOC_FILES := README.md changelog.md | ||
|
||
ALL_FILES := $(DOC_FILES) $(SCHEMA_FILES) $(LIB_FILES) $(OPENAI_FILES) $(ANTHROPIC_FILES) | ||
ALL_DIST_FILES := $(addprefix dist/, $(ALL_FILES)) | ||
|
||
dist: $(ALL_DIST_FILES) | ||
|
||
./dist/%: % | ||
mkdir -p $(dir $@) | ||
cp $< $@ | ||
|
||
# -- | ||
|
||
TEST_DIRS := $(dir $(wildcard */test)) | ||
|
||
TEST_TRIGGERS := $(addsuffix .test-trigger, $(TEST_DIRS)) | ||
|
||
test: $(TEST_TRIGGERS) | ||
|
||
%.test-trigger: | ||
cd $(dir $@) && npm test | ||
|
||
DEPS_TRIGGERS := $(addsuffix .deps-trigger, $(TEST_DIRS)) | ||
|
||
update-deps: $(DEPS_TRIGGERS) | ||
|
||
%.deps-trigger: | ||
cd $(dir $@) && npm install tplfa-jsonnet --update |
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,18 @@ | ||
{ | ||
"id": "msg_015ZPFSNXEvVHRymsG7H6Pab", | ||
"type": "message", | ||
"role": "assistant", | ||
"model": "claude-3-5-sonnet-20240620", | ||
"content": [ | ||
{ | ||
"type": "text", | ||
"text": "Pong!" | ||
} | ||
], | ||
"stop_reason": "end_turn", | ||
"stop_sequence": null, | ||
"usage": { | ||
"input_tokens": 17, | ||
"output_tokens": 55 | ||
} | ||
} |
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,16 @@ | ||
local response = std.parseJson(std.extVar("response")); | ||
|
||
{ | ||
doc: [ | ||
{ | ||
type: 'markdown', | ||
content: [ | ||
{ | ||
type: 'text', | ||
text: item.text | ||
} | ||
] | ||
} | ||
for item in response.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,11 @@ | ||
local openai = import "openai-request-tpl.jsonnet"; | ||
|
||
openai.run("https://api.anthropic.com/v1/messages", "key") + { | ||
headers+: { | ||
"Anthropic-version": "2023-06-01", | ||
}, | ||
body+: { | ||
"max_tokens": 1024, | ||
"model": "claude-3-5-sonnet-20240620", | ||
} | ||
} |
Oops, something went wrong.