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
const search = new SemanticSearch(apiKey, 'cohere'); |
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
{ | |
'openai/gpt-4': [ | |
{ | |
prediction: '<model-output>', | |
score_cosine_similarity: <score>, | |
score_euclidean_distance: <score> | |
} | |
], | |
'cohere/command': [ | |
{ |
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
function drawScene2(planet, data) { | |
// data ranges; kept only first 3 comparison parameters | |
var comparisonData = [{ | |
parameter: 'Equilibrium Temperature', | |
earth: { | |
min: 273.15, | |
max: 373.15 | |
}, | |
planet: +planet.pl_eqt |
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
function drawScene1(data) { | |
// prepare color scale | |
var colorScale = d3.scaleSequential() | |
.domain([2018, 2023]) | |
.interpolator(d3.interpolateOranges); | |
// create SVG for the visualization | |
var svg = d3.select("#visualization").append("svg") | |
.attr("width", 800) |
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
const llmEvaluation = new LLMEvaluation(openaiChatKey, 'openai'); | |
async function testLLMEvaluation() { | |
const userInput = "<add your question or prompt here>"; | |
// add idea answers, the more you add the better | |
const targetAnswers = ["<ideal answer 1>", | |
"<ideal answer 2>"]; | |
// the models set to compare |
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
const openaiChat = { | |
apiKey: openaiKey, | |
provider: SupportedChatModels.OPENAI, | |
type: 'chat', | |
model: 'gpt-4', | |
maxTokens: 50 | |
}; | |
const cohereCompletion = { | |
apiKey: cohereKey, |
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
const { LLMEvaluation, SupportedChatModels, SupportedLangModels } = require('intellinode'); |
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
export REPLICATE_API_KEY=<your-replica-key> | |
export OPENAI_API_KEY=<your-openai-key> | |
# optional - if you deployed Llama sagemaker ednpoint | |
export AWS_API_URL=<sagemaker-url> |
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
// When copying the code to the same file, ensure removing the repeated imports | |
const { Chatbot, ChatGPTInput, ChatGPTMessage } = require('intellinode'); | |
app.get('/chatgpt', async (req, res) => { | |
const chatbot = new Chatbot(process.env.OPENAI_API_KEY, 'openai'); | |
const system = 'You are a helpful assistant.'; | |
const input = new ChatGPTInput(system); | |
input.addUserMessage(req.query.message); |
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
// When copying the code to the same file, ensure removing the repeated imports | |
const { Chatbot, LLamaSageInput, SupportedChatModels } = require('intellinode'); | |
app.get('/llama/aws', async (req, res) => { | |
const chatbot = new Chatbot(null, SupportedChatModels.SAGEMAKER, {url: process.env.AWS_API_URL}); | |
const system = 'You are a helpful assistant.'; | |
const input = new LLamaSageInput(system); | |
input.addUserMessage(req.query.message); |
NewerOlder