@orizn/langchain 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/tools.d.ts +30 -0
- package/dist/tools.js +68 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orizn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @orizn/langchain
|
|
2
|
+
|
|
3
|
+
LangChain.js tools for the [Orizn Visa API](https://visa.orizn.app) — check visa requirements for 39,585 passport-destination pairs in 15 languages.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @orizn/langchain
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { OriznQuickVisaCheckTool, OriznVisaCheckTool } from "@orizn/langchain";
|
|
15
|
+
|
|
16
|
+
// No API key needed for quick checks
|
|
17
|
+
const quick = new OriznQuickVisaCheckTool();
|
|
18
|
+
const result = await quick.invoke(
|
|
19
|
+
{ passport: "FRA", destination: "JPN" }
|
|
20
|
+
);
|
|
21
|
+
console.log(result);
|
|
22
|
+
|
|
23
|
+
// Full details (needs API key)
|
|
24
|
+
const full = new OriznVisaCheckTool("your-api-key");
|
|
25
|
+
const details = await full.invoke(
|
|
26
|
+
{ passport: "FRA", destination: "JPN", lang: "fr" }
|
|
27
|
+
);
|
|
28
|
+
console.log(details);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Use with a LangChain agent
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { ChatOpenAI } from "@langchain/openai";
|
|
35
|
+
import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents";
|
|
36
|
+
import { OriznQuickVisaCheckTool, OriznVisaCheckTool } from "@orizn/langchain";
|
|
37
|
+
|
|
38
|
+
const tools = [
|
|
39
|
+
new OriznQuickVisaCheckTool(),
|
|
40
|
+
new OriznVisaCheckTool("your-api-key"),
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// Use with your preferred LangChain agent setup
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Available tools
|
|
47
|
+
|
|
48
|
+
| Tool | Description | API Key |
|
|
49
|
+
|------|-------------|---------|
|
|
50
|
+
| `OriznVisaCheckTool` | Full visa details with documents, process & tips | Required |
|
|
51
|
+
| `OriznQuickVisaCheckTool` | Quick yes/no visa check | Not needed |
|
|
52
|
+
|
|
53
|
+
## Links
|
|
54
|
+
|
|
55
|
+
- [API](https://visa.orizn.app)
|
|
56
|
+
- [Docs](https://visa.orizn.app/visa-api/dashboard/docs)
|
|
57
|
+
- [MCP Server](https://github.com/MattJeff/orizn-mcp-server)
|
|
58
|
+
- [Python package](https://pypi.org/project/langchain-orizn/)
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OriznVisaCheckTool, OriznQuickVisaCheckTool } from "./tools.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OriznVisaCheckTool, OriznQuickVisaCheckTool } from "./tools.js";
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StructuredTool } from "@langchain/core/tools";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare class OriznVisaCheckTool extends StructuredTool {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
passport: z.ZodString;
|
|
8
|
+
destination: z.ZodString;
|
|
9
|
+
lang: z.ZodDefault<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
private apiKey?;
|
|
12
|
+
constructor(apiKey?: string);
|
|
13
|
+
_call({ passport, destination, lang, }: {
|
|
14
|
+
passport: string;
|
|
15
|
+
destination: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
export declare class OriznQuickVisaCheckTool extends StructuredTool {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
schema: z.ZodObject<{
|
|
23
|
+
passport: z.ZodString;
|
|
24
|
+
destination: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
_call({ passport, destination, }: {
|
|
27
|
+
passport: string;
|
|
28
|
+
destination: string;
|
|
29
|
+
}): Promise<string>;
|
|
30
|
+
}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { StructuredTool } from "@langchain/core/tools";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const BASE_URL = "https://visa.orizn.app";
|
|
4
|
+
export class OriznVisaCheckTool extends StructuredTool {
|
|
5
|
+
name = "orizn_visa_check";
|
|
6
|
+
description = "Check visa requirements between any two countries. " +
|
|
7
|
+
"Returns visa type, duration, required documents, process steps, and travel tips. " +
|
|
8
|
+
"Covers 39,585 passport-destination pairs in 15 languages. " +
|
|
9
|
+
"Use ISO 3166-1 alpha-3 country codes (e.g., FRA for France, JPN for Japan).";
|
|
10
|
+
schema = z.object({
|
|
11
|
+
passport: z
|
|
12
|
+
.string()
|
|
13
|
+
.describe("ISO 3166-1 alpha-3 code of passport country (e.g., FRA, USA, JPN)"),
|
|
14
|
+
destination: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("ISO 3166-1 alpha-3 code of destination country (e.g., THA, BRA, GBR)"),
|
|
17
|
+
lang: z
|
|
18
|
+
.string()
|
|
19
|
+
.default("en")
|
|
20
|
+
.describe("Language code (en, fr, es, pt, de, ja, ko, zh, ru, it, ar, hi, th, vi, tl)"),
|
|
21
|
+
});
|
|
22
|
+
apiKey;
|
|
23
|
+
constructor(apiKey) {
|
|
24
|
+
super();
|
|
25
|
+
this.apiKey = apiKey ?? process.env.ORIZN_API_KEY;
|
|
26
|
+
}
|
|
27
|
+
async _call({ passport, destination, lang, }) {
|
|
28
|
+
const params = new URLSearchParams({
|
|
29
|
+
passport: passport.toUpperCase(),
|
|
30
|
+
destination: destination.toUpperCase(),
|
|
31
|
+
lang: lang ?? "en",
|
|
32
|
+
});
|
|
33
|
+
const headers = {};
|
|
34
|
+
if (this.apiKey) {
|
|
35
|
+
headers["x-api-key"] = this.apiKey;
|
|
36
|
+
}
|
|
37
|
+
const resp = await fetch(`${BASE_URL}/api/v1/visa?${params}`, { headers });
|
|
38
|
+
if (!resp.ok) {
|
|
39
|
+
throw new Error(`Orizn API error: ${resp.status} ${resp.statusText}`);
|
|
40
|
+
}
|
|
41
|
+
return JSON.stringify(await resp.json());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class OriznQuickVisaCheckTool extends StructuredTool {
|
|
45
|
+
name = "orizn_quick_visa_check";
|
|
46
|
+
description = "Quick check if a visa is required between two countries. " +
|
|
47
|
+
"Returns visa type (visa_free, visa_required, e_visa, visa_on_arrival, eta, no_admission) and duration. " +
|
|
48
|
+
"No API key needed. Use ISO 3166-1 alpha-3 codes.";
|
|
49
|
+
schema = z.object({
|
|
50
|
+
passport: z
|
|
51
|
+
.string()
|
|
52
|
+
.describe("ISO 3166-1 alpha-3 code of passport country"),
|
|
53
|
+
destination: z
|
|
54
|
+
.string()
|
|
55
|
+
.describe("ISO 3166-1 alpha-3 code of destination country"),
|
|
56
|
+
});
|
|
57
|
+
async _call({ passport, destination, }) {
|
|
58
|
+
const params = new URLSearchParams({
|
|
59
|
+
passport: passport.toUpperCase(),
|
|
60
|
+
destination: destination.toUpperCase(),
|
|
61
|
+
});
|
|
62
|
+
const resp = await fetch(`${BASE_URL}/api/v1/visa/check?${params}`);
|
|
63
|
+
if (!resp.ok) {
|
|
64
|
+
throw new Error(`Orizn API error: ${resp.status} ${resp.statusText}`);
|
|
65
|
+
}
|
|
66
|
+
return JSON.stringify(await resp.json());
|
|
67
|
+
}
|
|
68
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orizn/langchain",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "LangChain.js tools for Orizn Visa API — 39,585 passport-destination pairs in 15 languages",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"langchain",
|
|
14
|
+
"visa",
|
|
15
|
+
"travel",
|
|
16
|
+
"passport",
|
|
17
|
+
"ai-agent",
|
|
18
|
+
"tool",
|
|
19
|
+
"orizn"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/MattJeff/langchain-orizn-js"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://visa.orizn.app",
|
|
27
|
+
"author": "Orizn",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@langchain/core": ">=0.2.0",
|
|
36
|
+
"zod": ">=3.22.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": "^5.7.0",
|
|
40
|
+
"@types/node": "^22.10.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@langchain/core": ">=0.2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|