-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathnoop.ts
37 lines (32 loc) · 1.17 KB
/
noop.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
import { BaseOutputParser } from "@langchain/core/output_parsers";
/**
* The NoOpOutputParser class is a type of output parser that does not
* perform any operations on the output. It extends the BaseOutputParser
* class and is part of the LangChain's output parsers module. This class
* is useful in scenarios where the raw output of the Large Language
* Models (LLMs) is required.
*/
export class NoOpOutputParser extends BaseOutputParser<string> {
static lc_name() {
return "NoOpOutputParser";
}
lc_namespace = ["langchain", "output_parsers", "default"];
lc_serializable = true;
/**
* This method takes a string as input and returns the same string as
* output. It does not perform any operations on the input string.
* @param text The input string to be parsed.
* @returns The same input string without any operations performed on it.
*/
parse(text: string): Promise<string> {
return Promise.resolve(text);
}
/**
* This method returns an empty string. It does not provide any formatting
* instructions.
* @returns An empty string, indicating no formatting instructions.
*/
getFormatInstructions(): string {
return "";
}
}