-
Notifications
You must be signed in to change notification settings - Fork 2k
/
types.ts
108 lines (98 loc) 路 2.83 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* Represents the different types of arguments that can be used in
* LangChain.
*/
export type ArgumentsType =
| IdentifierType
| StringLiteralType
| NumericLiteralType
| ArrayLiteralType
| ObjectLiteralType
| CallExpressionType
| BooleanLiteralType;
/**
* Represents the parsed types in LangChain, which can be either an
* ArgumentsType or a PropertyAssignmentType.
*/
export type ParsedType = ArgumentsType | PropertyAssignmentType;
/**
* Represents an array literal in LangChain. It has a type property set to
* 'array_literal' and a values property which is an array of
* ArgumentsType.
*/
export type ArrayLiteralType = {
type: "array_literal";
values: ArgumentsType[];
};
/**
* Represents a boolean literal in LangChain. It has a type property set
* to 'boolean_literal' and a value property which is a boolean.
*/
export type BooleanLiteralType = {
type: "boolean_literal";
value: boolean;
};
/**
* Represents a call expression in LangChain. It has a type property set
* to 'call_expression', a funcCall property which can be a string or a
* MemberExpressionType, and an optional args property which is an array
* of ArgumentsType.
*/
export type CallExpressionType = {
type: "call_expression";
funcCall: string | MemberExpressionType;
args?: ArgumentsType[];
};
/**
* Represents a numeric literal in LangChain. It has a type property set
* to 'numeric_literal' and a value property which is a number.
*/
export type NumericLiteralType = {
type: "numeric_literal";
value: number;
};
/**
* Represents an object literal in LangChain. It has a type property set
* to 'object_literal' and a values property which is an array of
* PropertyAssignmentType.
*/
export type ObjectLiteralType = {
type: "object_literal";
values: PropertyAssignmentType[];
};
/**
* Represents a member expression in LangChain. It has a type property set
* to 'member_expression', an identifier property which is a string, and a
* property property which is also a string.
*/
export type MemberExpressionType = {
type: "member_expression";
identifier: string;
property: string;
};
/**
* Represents a property assignment in LangChain. It has a type property
* set to 'property_assignment', an identifier property which is a string,
* and a value property which is an ArgumentsType.
*/
export type PropertyAssignmentType = {
type: "property_assignment";
identifier: string;
value: ArgumentsType;
};
/**
* Represents a string literal in LangChain. It has a type property set to
* 'string_literal' and a value property which is a string.
*/
export type StringLiteralType = {
type: "string_literal";
value: string;
};
/**
* Represents an identifier in LangChain. It has a type property set to
* 'identifier' and a value property which is a string.
*/
export type IdentifierType = {
type: "identifier";
value: string;
};