@langchain/core
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,4 +0,4 @@ | ||
import { AgentAction, AgentFinish } from "../agents.js"; | ||
import type { AgentAction, AgentFinish } from "../agents.js"; | ||
import type { ChainValues } from "../utils/types.js"; | ||
import { LLMResult } from "../outputs.js"; | ||
import type { LLMResult } from "../outputs.js"; | ||
import { BaseCallbackHandler, CallbackHandlerMethods, HandleLLMNewTokenCallbackFields, NewTokenIndices } from "./base.js"; | ||
@@ -5,0 +5,0 @@ import { type BaseMessage } from "../messages/index.js"; |
@@ -1,4 +0,4 @@ | ||
import { BaseMessage, BaseMessageChunk, BaseMessageLike } from "../messages/index.js"; | ||
import { BaseMessage, BaseMessageChunk, type BaseMessageLike } from "../messages/index.js"; | ||
import { BasePromptValue } from "../prompt_values.js"; | ||
import { LLMResult, ChatGenerationChunk, ChatResult } from "../outputs.js"; | ||
import { type LLMResult, ChatGenerationChunk, type ChatResult } from "../outputs.js"; | ||
import { BaseLanguageModel, type BaseLanguageModelCallOptions, type BaseLanguageModelInput, type BaseLanguageModelParams } from "./base.js"; | ||
@@ -5,0 +5,0 @@ import { CallbackManagerForLLMRun, Callbacks } from "../callbacks/manager.js"; |
import { BaseMessage } from "../messages/index.js"; | ||
import { BasePromptValue } from "../prompt_values.js"; | ||
import { LLMResult, GenerationChunk } from "../outputs.js"; | ||
import { BaseCallbackConfig, CallbackManagerForLLMRun, Callbacks } from "../callbacks/manager.js"; | ||
import { type LLMResult, GenerationChunk } from "../outputs.js"; | ||
import { type BaseCallbackConfig, CallbackManagerForLLMRun, type Callbacks } from "../callbacks/manager.js"; | ||
import { BaseLanguageModel, type BaseLanguageModelCallOptions, type BaseLanguageModelInput, type BaseLanguageModelParams } from "./base.js"; | ||
import { RunnableConfig } from "../runnables/config.js"; | ||
import type { RunnableConfig } from "../runnables/config.js"; | ||
export type SerializedLLM = { | ||
@@ -8,0 +8,0 @@ _model: string; |
import { AIMessage, getBufferString } from "../messages/index.js"; | ||
import { RUN_KEY, GenerationChunk } from "../outputs.js"; | ||
import { RUN_KEY, GenerationChunk, } from "../outputs.js"; | ||
import { CallbackManager, } from "../callbacks/manager.js"; | ||
@@ -4,0 +4,0 @@ import { BaseLanguageModel, } from "./base.js"; |
import { Tiktoken, TiktokenEncoding, TiktokenModel } from "js-tiktoken/lite"; | ||
export declare function getEncoding(encoding: TiktokenEncoding, options?: { | ||
signal?: AbortSignal; | ||
extendedSpecialTokens?: Record<string, number>; | ||
}): Promise<Tiktoken>; | ||
export declare function encodingForModel(model: TiktokenModel, options?: { | ||
signal?: AbortSignal; | ||
extendedSpecialTokens?: Record<string, number>; | ||
}): Promise<Tiktoken>; | ||
export declare function getEncoding(encoding: TiktokenEncoding): Promise<Tiktoken>; | ||
export declare function encodingForModel(model: TiktokenModel): Promise<Tiktoken>; |
@@ -5,9 +5,8 @@ import { Tiktoken, getEncodingNameForModel, } from "js-tiktoken/lite"; | ||
const caller = /* #__PURE__ */ new AsyncCaller({}); | ||
export async function getEncoding(encoding, options) { | ||
export async function getEncoding(encoding) { | ||
if (!(encoding in cache)) { | ||
cache[encoding] = caller | ||
.fetch(`https://tiktoken.pages.dev/js/${encoding}.json`, { | ||
signal: options?.signal, | ||
}) | ||
.fetch(`https://tiktoken.pages.dev/js/${encoding}.json`) | ||
.then((res) => res.json()) | ||
.then((data) => new Tiktoken(data)) | ||
.catch((e) => { | ||
@@ -18,6 +17,6 @@ delete cache[encoding]; | ||
} | ||
return new Tiktoken(await cache[encoding], options?.extendedSpecialTokens); | ||
return await cache[encoding]; | ||
} | ||
export async function encodingForModel(model, options) { | ||
return getEncoding(getEncodingNameForModel(model), options); | ||
export async function encodingForModel(model) { | ||
return getEncoding(getEncodingNameForModel(model)); | ||
} |
{ | ||
"name": "@langchain/core", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Core LangChain.js abstractions and schemas", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"decamelize": "1.2.0", | ||
"js-tiktoken": "^1.0.7", | ||
"js-tiktoken": "^1.0.8", | ||
"langsmith": "^0.0.48", | ||
@@ -43,0 +43,0 @@ "p-queue": "^6.6.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1140764
28355
Updatedjs-tiktoken@^1.0.8