-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"parent":null,"pid":3709,"argv":["/opt/homebrew/Cellar/node/20.5.1/bin/node","/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo/node_modules/.bin/tap","--ts"],"execArgv":[],"cwd":"/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo","time":1694583338577,"ppid":3708,"coverageFilename":"/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo/.nyc_output/69330958-c7d6-4b21-bd2e-73292007bc48.json","externalId":"","uuid":"69330958-c7d6-4b21-bd2e-73292007bc48","files":[]} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"parent":"69330958-c7d6-4b21-bd2e-73292007bc48","pid":3710,"argv":["/opt/homebrew/Cellar/node/20.5.1/bin/node","/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo/app.test.js"],"execArgv":[],"cwd":"/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo","time":1694583338891,"ppid":3709,"coverageFilename":"/Users/harshvardhanparmar/Github-Projects/EdgeChains/JS/jsonnet-demo/.nyc_output/ef8874cb-60b5-4d41-bd70-5b0277756cd4.json","externalId":"app.test.js","uuid":"ef8874cb-60b5-4d41-bd70-5b0277756cd4","files":[]} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"processes":{"69330958-c7d6-4b21-bd2e-73292007bc48":{"parent":null,"children":["ef8874cb-60b5-4d41-bd70-5b0277756cd4"]},"ef8874cb-60b5-4d41-bd70-5b0277756cd4":{"parent":"69330958-c7d6-4b21-bd2e-73292007bc48","externalId":"app.test.js","children":[]}},"files":{},"externalIds":{"app.test.js":{"root":"ef8874cb-60b5-4d41-bd70-5b0277756cd4","children":[]}}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Jsonnet } from "@hanazuki/node-jsonnet"; | ||
const jsonnet = new Jsonnet(); | ||
|
||
// Evaluates a simple Jsonnet program into a JSON value | ||
const result = await jsonnet.extString("keepMaxToken","true") | ||
.extString("query","") | ||
.extString("keepContext","true") | ||
.extString("context","") | ||
.extString("history","") | ||
.extString("keepChatHistory","true") | ||
.extCode("maxToken","100") | ||
.evaluateFile('./example.jsonnet') | ||
.then(); | ||
|
||
|
||
export async function parseJsonnet(){ | ||
return JSON.parse(result); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { test, beforeEach, afterEach } from 'tap'; | ||
import { parseJsonnet } from './app.js'; | ||
|
||
test('Parse Jsonnet',async ({same,end}) =>{ | ||
const result = await parseJsonnet(); | ||
same(result,{ | ||
context: '', | ||
history: 'Chat History: ', | ||
maxTokens: 100, | ||
preset: 'You will be given context that may or may not be related to the question. If the context is related to the question, use it to answer the question.\n' + | ||
" Otherwise, say that you don't know the answer, and attempt to answer it anyways using an 'In General' format\n" + | ||
' Follow Up Input: {question}\n' + | ||
' Context: {context}\n' + | ||
' Chat History: {chat_history}\n', | ||
prompt: 'Question: \n' + | ||
'You will be given context that may or may not be related to the question. If the context ', | ||
query: 'Question: ', | ||
topK: 5 | ||
}); | ||
end; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
local maxTokens = if(std.extVar("keepMaxToken") == "true") then std.extVar("maxToken") else 10000; | ||
local preset = ||| | ||
You will be given context that may or may not be related to the question. If the context is related to the question, use it to answer the question. | ||
Otherwise, say that you don't know the answer, and attempt to answer it anyways using an 'In General' format | ||
Follow Up Input: {question} | ||
Context: {context} | ||
Chat History: {chat_history} | ||
|||; | ||
local query = "Question: "+ std.extVar("query"); | ||
local context = if(std.extVar("keepContext") == "true") then std.extVar("context") else ""; | ||
local history = "Chat History: "+ if(std.extVar("keepChatHistory") == "true") then std.extVar("history") else ""; | ||
local prompt = std.join("\n", [query, preset, context, history]); | ||
{ | ||
"maxTokens": maxTokens, | ||
"topK": 5, | ||
"query": query, | ||
"preset" : preset, | ||
"context": context, | ||
"history": history, | ||
"prompt": if(std.length(prompt) > maxTokens) then std.substr(prompt, 0, maxTokens) else prompt | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.