Back to all reviewers

Platform-appropriate environment variables

langchain-ai/langchainjs
Based on 2 comments
JavaScript

Always use the correct syntax for accessing environment variables based on the target platform. In JavaScript/Node.js environments, use `process.env.VARIABLE_NAME` instead of syntaxes from other languages (e.g., Python's `os.environ`).

Configurations JavaScript

Reviewer Prompt

Always use the correct syntax for accessing environment variables based on the target platform. In JavaScript/Node.js environments, use process.env.VARIABLE_NAME instead of syntaxes from other languages (e.g., Python’s os.environ).

Example:

// Incorrect - Using Python syntax in JavaScript
const config = {
  azure_endpoint: os.environ["AZURE_OPENAI_ENDPOINT"],
  azure_deployment: os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"],
  openai_api_version: os.environ["AZURE_OPENAI_API_VERSION"]
};

// Correct - Using JavaScript syntax
const config = {
  azure_endpoint: process.env.AZURE_OPENAI_ENDPOINT,
  azure_deployment: process.env.AZURE_OPENAI_DEPLOYMENT_NAME,
  openai_api_version: process.env.AZURE_OPENAI_API_VERSION
};

For platform-specific configurations, consider using appropriate file formats (like .mdx for Node-specific code) or implement automatic import methods that work across environments to improve compatibility.

2
Comments Analyzed
JavaScript
Primary Language
Configurations
Category

Source Discussions