Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langchain[patch]: onToken event added in ChatLlamaCpp call function #3443

Merged
merged 6 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion langchain/src/chat_models/llama_cpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class ChatLlamaCpp extends SimpleChatModel<LlamaCppCallOptions> {
/** @ignore */
async _call(
messages: BaseMessage[],
_options: this["ParsedCallOptions"]
options: this["ParsedCallOptions"]
): Promise<string> {
let prompt = "";

Expand All @@ -136,6 +136,7 @@ export class ChatLlamaCpp extends SimpleChatModel<LlamaCppCallOptions> {

try {
const promptOptions = {
onToken: options.onToken,
maxTokens: this?.maxTokens,
temperature: this?.temperature,
topK: this?.topK,
Expand Down
3 changes: 2 additions & 1 deletion langchain/src/llms/llama_cpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ export class LlamaCpp extends LLM<LlamaCppCallOptions> {
/** @ignore */
async _call(
prompt: string,
_options?: this["ParsedCallOptions"]
options?: this["ParsedCallOptions"]
): Promise<string> {
try {
const promptOptions = {
onToken: options?.onToken,
maxTokens: this?.maxTokens,
temperature: this?.temperature,
topK: this?.topK,
Expand Down