This file contains hidden or 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 prompt = `Building a website can be done in 10 simple steps:`; | |
const stream = true; | |
async function Test() { | |
let response = await fetch("http://127.0.0.1:8080/completion", { | |
method: 'POST', | |
body: JSON.stringify({ | |
prompt, | |
n_predict: 512, | |
}) |
This file contains hidden or 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
import bs4 | |
from langchain import hub | |
from langchain_community.document_loaders import WebBaseLoader | |
from langchain_chroma import Chroma | |
from langchain_core.output_parsers import StrOutputParser | |
from langchain_core.runnables import RunnablePassthrough | |
from langchain_community.embeddings import GPT4AllEmbeddings | |
from langchain.prompts import PromptTemplate | |
from langchain_text_splitters import RecursiveCharacterTextSplitter | |
from langchain_community.llms import LlamaCpp |
This file contains hidden or 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
root ::= Book | |
Auther ::= "{" ws "\"firstName\":" ws string "," ws "\"lastName\":" ws string "," ws "\"age\":" ws number "}" | |
Autherlist ::= "[]" | "[" ws Auther ("," ws Auther)* "]" | |
Book ::= "{" ws "\"title\":" ws string "," ws "\"subtitle\":" ws string "," ws "\"authers\":" ws Autherlist "," ws "\"genres\":" ws stringlist "," ws "\"pages\":" ws number "," ws "\"description\":" ws string "," ws "\"isbn\":" ws string "}" | |
Booklist ::= "[]" | "[" ws Book ("," ws Book)* "]" | |
string ::= "\"" ([^"]*) "\"" | |
boolean ::= "true" | "false" | |
ws ::= [ \t\n]* | |
number ::= [0-9]+ "."? [0-9]* | |
stringlist ::= "[" ws "]" | "[" ws string ("," ws string)* ws "]" |
This file contains hidden or 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
root ::= answer | |
answer ::= (weather | complaint | yesno) | |
weather ::= ("Sunny." | "Cloudy." | "Rainy.") | |
complaint ::= "I don't like talking about the weather." | |
yesno ::= ("Yes." | "No.") |
This file contains hidden or 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
root ::= CarAndOwner | |
PerformanceFeature ::= "{" ws "\"engine\":" ws string "," ws "\"horsepower\":" ws number "," ws "\"topSpeed\":" ws number "}" | |
PerformanceFeaturelist ::= "[]" | "[" ws PerformanceFeature ("," ws PerformanceFeature)* "]" | |
SafetyFeature ::= "{" ws "\"airbags\":" ws number "," ws "\"parkingSensors\":" ws number "," ws "\"laneAssist\":" ws number "}" | |
SafetyFeaturelist ::= "[]" | "[" ws SafetyFeature ("," ws SafetyFeature)* "]" | |
AudioFeature ::= "{" ws "\"brand\":" ws string "," ws "\"speakers\":" ws number "," ws "\"hasBluetooth\":" ws boolean "}" | |
AudioFeaturelist ::= "[]" | "[" ws AudioFeature ("," ws AudioFeature)* "]" | |
Features ::= "{" ws "\"audio\":" ws AudioFeature "," ws "\"safety\":" ws SafetyFeature "," ws "\"performance\":" ws PerformanceFeature "}" | |
Featureslist ::= "[]" | "[" ws Features ("," ws Features)* "]" | |
Owner ::= " |
This file contains hidden or 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
root ::= item+ | |
item ::= "- " [^\r\n\x0b\x0c\x85\u2028\u2029]+ "\n" |
This file contains hidden or 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
// 具名函式 named function | |
function foo(name: string) { | |
return 'foo ' + name; | |
} | |
// 函式運算式 function expression | |
let foo2 = function (name: string) { | |
return 'foo ' + name; | |
} |
This file contains hidden or 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 MyObject(name, message) { | |
this.name = name.toString(); | |
this.message = message.toString(); | |
} | |
(function() { | |
this.getName = function() { | |
return this.name; | |
}; | |
this.getMessage = function() { | |
return this.message; |
This file contains hidden or 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 MyObject(name, message) { | |
this.name = name.toString(); | |
this.message = message.toString(); | |
} | |
MyObject.prototype.getName = function() { | |
return this.name; | |
}; | |
MyObject.prototype.getMessage = function() { | |
return this.message; | |
}; |
This file contains hidden or 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 MyObject(name, message) { | |
this.name = name.toString(); | |
this.message = message.toString(); | |
this.getName = function() { | |
return this.name; | |
}; | |
this.getMessage = function() { | |
return this.message; | |
}; |
NewerOlder