@typia/langchain 12.0.0-dev.20260225 → 12.0.0-dev.20260227

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +3 -4
package/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # `@typia/langchain`
2
2
 
3
+ ![Typia Logo](https://typia.io/logo.png)
4
+
3
5
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
4
6
  [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
5
7
  [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
8
+ [![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
9
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
10
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
11
+ [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
6
12
 
7
13
  [LangChain.js](https://github.com/langchain-ai/langchainjs) integration for [`typia`](https://github.com/samchon/typia).
8
14
 
@@ -66,6 +72,42 @@ const tools: DynamicStructuredTool[] = toLangChainTools({
66
72
  });
67
73
  ```
68
74
 
75
+ ### Structured Output
76
+
77
+ Use `typia.llm.parameters<T>()` with LangChain's `withStructuredOutput()` to generate structured output with validation:
78
+
79
+ ```typescript
80
+ import { ChatOpenAI } from "@langchain/openai";
81
+ import { dedent, stringifyValidationFailure } from "@typia/utils";
82
+ import typia, { tags } from "typia";
83
+
84
+ interface IMember {
85
+ email: string & tags.Format<"email">;
86
+ name: string;
87
+ age: number & tags.Minimum<0> & tags.Maximum<100>;
88
+ hobbies: string[];
89
+ joined_at: string & tags.Format<"date">;
90
+ }
91
+
92
+ const model = new ChatOpenAI({ model: "gpt-4o" }).withStructuredOutput(
93
+ typia.llm.parameters<IMember>(),
94
+ );
95
+
96
+ const member: IMember = await model.invoke(dedent`
97
+ I am a new member of the community.
98
+
99
+ My name is John Doe, and I am 25 years old.
100
+ I like playing basketball and reading books,
101
+ and joined to this community at 2022-01-01.
102
+ `);
103
+
104
+ // Validate the result
105
+ const result = typia.validate<IMember>(member);
106
+ if (!result.success) {
107
+ console.error(stringifyValidationFailure(result));
108
+ }
109
+ ```
110
+
69
111
  ## Features
70
112
 
71
113
  - No manual schema definition — generates everything from TypeScript types or OpenAPI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typia/langchain",
3
- "version": "12.0.0-dev.20260225",
3
+ "version": "12.0.0-dev.20260227",
4
4
  "description": "LangChain.js integration for typia",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -23,8 +23,8 @@
23
23
  "homepage": "https://typia.io",
24
24
  "dependencies": {
25
25
  "zod": "^3.25.0",
26
- "@typia/interface": "^12.0.0-dev.20260225",
27
- "@typia/utils": "^12.0.0-dev.20260225"
26
+ "@typia/interface": "^12.0.0-dev.20260227",
27
+ "@typia/utils": "^12.0.0-dev.20260227"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@langchain/core": ">=0.3.0"
@@ -43,7 +43,6 @@
43
43
  },
44
44
  "sideEffects": false,
45
45
  "files": [
46
- "LICENSE",
47
46
  "README.md",
48
47
  "package.json",
49
48
  "lib",