3 Commits

Author SHA1 Message Date
eabe49552d chore: Clean up repo 2026-07-17 09:22:18 +05:30
444c722708 feat(gui): Improve provider icons 2026-07-17 08:28:38 +05:30
64e049c976 feat(gui): Added icons for model providers 2026-07-17 07:25:48 +05:30
11 changed files with 31 additions and 237 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -103,7 +103,7 @@ export function ConfigView() {
return (
<div className="flex-1 overflow-y-auto w-full relative">
<div className="relative z-10 mx-auto max-w-[800px] px-10 py-12">
<div className="relative z-10 mx-auto max-w-[1024px] px-10 py-12">
<h1 className="mb-6 text-headline-lg text-primary animate-fade-in">
Configuration
</h1>

View File

@@ -54,6 +54,16 @@ import { Empty, EmptyTitle, EmptyDescription } from "@/components/ui/empty";
import { cn } from "@/lib/utils";
import { RefreshCwIcon } from "lucide-react";
const providerLogoMap: Record<string, string> = {
anthropic: "/claude_logo.webp",
"google-genai": "/gemini_logo.webp",
openrouter: "/openrouter_logo.webp",
ollama: "/ollama_logo.webp",
deepseek: "/deepseek_logo.webp",
openai: "/openai_logo.webp",
groq: "/groq_logo.webp",
};
interface ProviderInstancesConfigProps {
instances: ModelProviderInstance[];
availableProviders: ModelProviderMeta[];
@@ -337,7 +347,7 @@ export function ProviderInstancesConfig({
};
return (
<section className="mb-8">
<section className="mb-8 flex min-h-[600px] flex-col">
{error && (
<div className="mb-4 rounded border-2 border-red-500 bg-red-50 px-3 py-2 text-sm text-red-700">
{error}
@@ -345,7 +355,7 @@ export function ProviderInstancesConfig({
)}
<div
className={cn(
"mt-4 grid min-h-[400px] grid-cols-1 gap-4 md:grid-cols-[30%_70%]",
"mt-4 grid flex-1 grid-cols-1 gap-4 md:grid-cols-[30%_70%]",
loading && "pointer-events-none opacity-60",
"transition-opacity duration-200",
)}
@@ -379,14 +389,22 @@ export function ProviderInstancesConfig({
)}
onClick={() => setSelectedInstanceId(inst.id)}
>
<ItemContent>
<ItemTitle>{inst.name}</ItemTitle>
<ItemDescription>{inst.providerName}</ItemDescription>
<div className="flex flex-row gap-1.5">
{inst.isActive && <Badge>Active</Badge>}
<Badge variant="outline">
{inst.type === "generative" ? "gen" : "embed"}
</Badge>
<ItemContent className="flex-row items-center gap-3">
{providerLogoMap[inst.providerName] && (
<img
src={providerLogoMap[inst.providerName]}
alt={inst.providerName}
className="max-h-[38px] max-w-[38px] shrink-0 rounded-sm object-contain"
/>
)}
<div className="flex flex-col gap-1">
<ItemTitle>{inst.name}</ItemTitle>
<div className="flex flex-row gap-1.5">
{inst.isActive && <Badge>Active</Badge>}
<Badge variant="outline">
{inst.type === "generative" ? "gen" : "embed"}
</Badge>
</div>
</div>
</ItemContent>
</Item>
@@ -431,6 +449,7 @@ export function ProviderInstancesConfig({
<div className="grid grid-cols-[2fr_3fr] gap-4">
<div className="flex flex-col gap-1.5">
<Label>Instance Type</Label>
{/* TODO: Change this to choice card */}
<Select
value={editType}
onValueChange={(v) =>

View File

@@ -188,7 +188,7 @@ export function HomeView() {
return (
<div className="flex-1 overflow-y-auto w-full relative">
<div className="relative z-10 mx-auto max-w-[800px] px-10 py-12">
<div className="relative z-10 mx-auto max-w-[1024px] px-10 py-12">
<div className="animate-fade-in">
{/* Centered Big Logo */}
<div className="flex flex-col items-center justify-center mb-10 pt-4">

View File

@@ -1,225 +0,0 @@
> ## Documentation Index
>
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.
# OpenAI integrations
> Integrate with OpenAI using LangChain JavaScript.
LangChain integrates with OpenAI and Azure OpenAI through the `@langchain/openai` package.
> [OpenAI](https://en.wikipedia.org/wiki/OpenAI) is American artificial intelligence (AI) research laboratory
> consisting of the non-profit `OpenAI Incorporated`
> and its for-profit subsidiary corporation `OpenAI Limited Partnership`.
> OpenAI conducts AI research with the declared intention of promoting and developing a friendly AI.
> OpenAI systems run on an `Azure`-based supercomputing platform from `Microsoft`.
> The [OpenAI API](https://platform.openai.com/docs/models) is powered by a diverse set of models with different capabilities and price points.
>
> [ChatGPT](https://chat.openai.com) is the Artificial Intelligence (AI) chatbot developed by `OpenAI`.
## Installation and setup
- Get an OpenAI api key and set it as an environment variable (`OPENAI_API_KEY`)
## Chat model
See a [usage example](/oss/javascript/integrations/chat/openai).
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatOpenAI } from "@langchain/openai";
```
## LLM
See a [usage example](/oss/javascript/integrations/llms/openai).
<Tip>
See [this section for general instructions on installing LangChain packages](/oss/javascript/langchain/install).
</Tip>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/openai @langchain/core
```
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { OpenAI } from "@langchain/openai";
```
## Text embedding model
See a [usage example](/oss/javascript/integrations/embeddings/openai)
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { OpenAIEmbeddings } from "@langchain/openai";
```
## Chain
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { OpenAIModerationChain } from "@langchain/classic/chains";
```
## Middleware
Middleware specifically designed for OpenAI models. Learn more about [middleware](/oss/javascript/langchain/middleware/overview).
| Middleware | Description |
| ----------------------------------------- | --------------------------------------------------------- |
| [Content moderation](#content-moderation) | Moderate agent traffic using OpenAI's moderation endpoint |
### Content moderation
Moderate agent traffic (user input, model output, and tool results) using OpenAI's moderation endpoint to detect and handle unsafe content. Content moderation is useful for the following:
- Applications requiring content safety and compliance
- Filtering harmful, hateful, or inappropriate content
- Customer-facing agents that need safety guardrails
- Meeting platform moderation requirements
<Info>
Learn more about [OpenAI's moderation models](https://platform.openai.com/docs/guides/moderation) and categories.
</Info>
**API reference:** [`openAIModerationMiddleware`](https://reference.langchain.com/javascript/langchain/index/openAIModerationMiddleware)
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { createAgent, openAIModerationMiddleware } from "langchain";
const agent = createAgent({
model: "openai:gpt-5.5",
tools: [searchTool, databaseTool],
middleware: [
openAIModerationMiddleware({
model: "openai:gpt-5.5",
moderationModel: "omni-moderation-latest",
checkInput: true,
checkOutput: true,
exitBehavior: "end",
}),
],
});
```
<Accordion title="Configuration options">
<ParamField body="model" type="string | BaseChatModel" required>
OpenAI model to use for moderation. Can be either a model name string (e.g., `"openai:gpt-5.5"`) or a `BaseChatModel` instance. The middleware will use this model's client to access the moderation endpoint.
</ParamField>
<ParamField body="moderationModel" type="ModerationModel" default="omni-moderation-latest">
OpenAI moderation model to use. Options: `'omni-moderation-latest'`, `'omni-moderation-2024-09-26'`, `'text-moderation-latest'`, `'text-moderation-stable'`
</ParamField>
<ParamField body="checkInput" type="boolean" default="true">
Whether to check user input messages before the model is called
</ParamField>
<ParamField body="checkOutput" type="boolean" default="true">
Whether to check model output messages after the model is called
</ParamField>
<ParamField body="checkToolResults" type="boolean" default="false">
Whether to check tool result messages before the model is called
</ParamField>
<ParamField body="exitBehavior" type="'error' | 'end' | 'replace'" default="'end'">
How to handle violations when content is flagged. Options:
* `'end'` - End agent execution immediately with a violation message
* `'error'` - Throw `OpenAIModerationError` exception
* `'replace'` - Replace the flagged content with the violation message and continue
</ParamField>
<ParamField body="violationMessage" type="string | undefined">
Custom template for violation messages. Supports template variables:
* `{categories}` - Comma-separated list of flagged categories
* `{category_scores}` - JSON string of category scores
* `{original_content}` - The original flagged content
Default: `"I'm sorry, but I can't comply with that request. It was flagged for {categories}."`
</ParamField>
</Accordion>
<Accordion title="Full example">
The middleware integrates OpenAI's moderation endpoint to check content at different stages:
**Moderation stages:**
- `checkInput` - User messages before model call
- `checkOutput` - AI messages after model call
- `checkToolResults` - Tool outputs before model call
**Exit behaviors:**
- `'end'` (default) - Stop execution with violation message
- `'error'` - Throw exception for application handling
- `'replace'` - Replace flagged content and continue
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { createAgent, openAIModerationMiddleware } from "langchain";
// Basic moderation
const agent = createAgent({
model: "openai:gpt-5.5",
tools: [searchTool, customerDataTool],
middleware: [
openAIModerationMiddleware({
model: "openai:gpt-5.5",
moderationModel: "omni-moderation-latest",
checkInput: true,
checkOutput: true,
}),
],
});
// Strict moderation with custom message
const agentStrict = createAgent({
model: "openai:gpt-5.5",
tools: [searchTool, customerDataTool],
middleware: [
openAIModerationMiddleware({
model: "openai:gpt-5.5",
moderationModel: "omni-moderation-latest",
checkInput: true,
checkOutput: true,
checkToolResults: true,
exitBehavior: "error",
violationMessage:
"Content policy violation detected: {categories}. " +
"Please rephrase your request.",
}),
],
});
// Moderation with replacement behavior
const agentReplace = createAgent({
model: "openai:gpt-5.5",
tools: [searchTool],
middleware: [
openAIModerationMiddleware({
model: "openai:gpt-5.5",
checkInput: true,
exitBehavior: "replace",
violationMessage: "[Content removed due to safety policies]",
}),
],
});
```
</Accordion>
---
<div className="source-links">
<Callout icon="terminal-2">
[Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Callout>
<Callout icon="edit">
[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/providers/openai.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
</Callout>
</div>