langsmith
Advanced tools
Comparing version 0.0.61 to 0.0.62
@@ -50,2 +50,3 @@ import { AsyncCallerParams } from "./utils/async_caller.js"; | ||
project_name?: string; | ||
revision_id?: string; | ||
} | ||
@@ -52,0 +53,0 @@ interface projectOptions { |
import * as uuid from "uuid"; | ||
import { AsyncCaller } from "./utils/async_caller.js"; | ||
import { convertLangChainMessageToExample, isLangChainMessage, } from "./utils/messages.js"; | ||
import { getEnvironmentVariable, getRuntimeEnvironment } from "./utils/env.js"; | ||
import { getEnvironmentVariable, getLangChainEnvVarsMetadata, getRuntimeEnvironment, } from "./utils/env.js"; | ||
import { __version__ } from "./index.js"; | ||
@@ -219,3 +219,5 @@ // utility functions | ||
const extra = run.extra ?? {}; | ||
const metadata = extra.metadata; | ||
const runtimeEnv = await getRuntimeEnvironment(); | ||
const envVars = getLangChainEnvVarsMetadata(); | ||
const session_name = run.project_name; | ||
@@ -232,2 +234,9 @@ delete run.project_name; | ||
}, | ||
metadata: { | ||
...envVars, | ||
...(envVars.revision_id || run.revision_id | ||
? { revision_id: run.revision_id ?? envVars.revision_id } | ||
: {}), | ||
...metadata, | ||
}, | ||
}, | ||
@@ -234,0 +243,0 @@ }; |
export { Client } from "./client.js"; | ||
export { Dataset, Example, TracerSession, Run, Feedback } from "./schemas.js"; | ||
export { RunTree, RunTreeConfig } from "./run_trees.js"; | ||
export declare const __version__ = "0.0.61"; | ||
export declare const __version__ = "0.0.62"; |
export { Client } from "./client.js"; | ||
export { RunTree } from "./run_trees.js"; | ||
// Update using yarn bump-version | ||
export const __version__ = "0.0.61"; | ||
export const __version__ = "0.0.62"; |
@@ -25,3 +25,3 @@ declare global { | ||
* Retrieves the LangChain-specific environment variables from the current runtime environment. | ||
* Sensitive keys (containing the word "key") have their values redacted for security. | ||
* Sensitive keys (containing the word "key", "token", or "secret") have their values redacted for security. | ||
* | ||
@@ -33,2 +33,9 @@ * @returns {Record<string, string>} | ||
/** | ||
* Retrieves the LangChain-specific metadata from the current runtime environment. | ||
* | ||
* @returns {Record<string, string>} | ||
* - A record of LangChain-specific metadata environment variables. | ||
*/ | ||
export declare function getLangChainEnvVarsMetadata(): Record<string, string>; | ||
/** | ||
* Retrieves the environment variables from the current runtime environment. | ||
@@ -35,0 +42,0 @@ * |
@@ -61,3 +61,3 @@ // Inlined from https://github.com/flexdinesh/browser-or-node | ||
* Retrieves the LangChain-specific environment variables from the current runtime environment. | ||
* Sensitive keys (containing the word "key") have their values redacted for security. | ||
* Sensitive keys (containing the word "key", "token", or "secret") have their values redacted for security. | ||
* | ||
@@ -76,3 +76,6 @@ * @returns {Record<string, string>} | ||
for (const key in envVars) { | ||
if (key.toLowerCase().includes("key") && typeof envVars[key] === "string") { | ||
if ((key.toLowerCase().includes("key") || | ||
key.toLowerCase().includes("secret") || | ||
key.toLowerCase().includes("token")) && | ||
typeof envVars[key] === "string") { | ||
const value = envVars[key]; | ||
@@ -86,2 +89,35 @@ envVars[key] = | ||
/** | ||
* Retrieves the LangChain-specific metadata from the current runtime environment. | ||
* | ||
* @returns {Record<string, string>} | ||
* - A record of LangChain-specific metadata environment variables. | ||
*/ | ||
export function getLangChainEnvVarsMetadata() { | ||
const allEnvVars = getEnvironmentVariables() || {}; | ||
const envVars = {}; | ||
const excluded = [ | ||
"LANGCHAIN_API_KEY", | ||
"LANGCHAIN_ENDPOINT", | ||
"LANGCHAIN_TRACING_V2", | ||
"LANGCHAIN_PROJECT", | ||
"LANGCHAIN_SESSION", | ||
]; | ||
for (const [key, value] of Object.entries(allEnvVars)) { | ||
if (key.startsWith("LANGCHAIN_") && | ||
typeof value === "string" && | ||
!excluded.includes(key) && | ||
!key.toLowerCase().includes("key") && | ||
!key.toLowerCase().includes("secret") && | ||
!key.toLowerCase().includes("token")) { | ||
if (key === "LANGCHAIN_REVISION_ID") { | ||
envVars["revision_id"] = value; | ||
} | ||
else { | ||
envVars[key] = value; | ||
} | ||
} | ||
} | ||
return envVars; | ||
} | ||
/** | ||
* Retrieves the environment variables from the current runtime environment. | ||
@@ -102,3 +138,3 @@ * | ||
// eslint-disable-next-line no-process-env | ||
Object.entries(process.env).reduce((acc, [key, value]) => { | ||
return Object.entries(process.env).reduce((acc, [key, value]) => { | ||
acc[key] = String(value); | ||
@@ -105,0 +141,0 @@ return acc; |
{ | ||
"name": "langsmith", | ||
"version": "0.0.61", | ||
"version": "0.0.62", | ||
"description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
194188
4750