langchain 0.0.213 → 0.0.214

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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/openai_functions/index.cjs +2 -0
  3. package/dist/agents/openai_functions/index.d.ts +2 -0
  4. package/dist/agents/openai_functions/index.js +2 -0
  5. package/dist/agents/openai_tools/index.cjs +2 -0
  6. package/dist/agents/openai_tools/index.d.ts +2 -0
  7. package/dist/agents/openai_tools/index.js +2 -0
  8. package/dist/agents/react/index.cjs +2 -0
  9. package/dist/agents/react/index.d.ts +2 -0
  10. package/dist/agents/react/index.js +2 -0
  11. package/dist/agents/structured_chat/index.cjs +2 -0
  12. package/dist/agents/structured_chat/index.d.ts +2 -0
  13. package/dist/agents/structured_chat/index.js +2 -0
  14. package/dist/agents/xml/index.cjs +2 -0
  15. package/dist/agents/xml/index.d.ts +2 -0
  16. package/dist/agents/xml/index.js +2 -0
  17. package/dist/callbacks/index.cjs +1 -4
  18. package/dist/callbacks/index.d.ts +1 -2
  19. package/dist/callbacks/index.js +1 -2
  20. package/dist/chains/openai_functions/structured_output.cjs +63 -21
  21. package/dist/chains/openai_functions/structured_output.d.ts +25 -17
  22. package/dist/chains/openai_functions/structured_output.js +62 -20
  23. package/dist/experimental/autogpt/prompt.cjs +1 -1
  24. package/dist/experimental/autogpt/prompt.d.ts +1 -1
  25. package/dist/experimental/autogpt/prompt.js +1 -1
  26. package/dist/retrievers/multi_vector.cjs +11 -2
  27. package/dist/retrievers/multi_vector.d.ts +5 -3
  28. package/dist/retrievers/multi_vector.js +11 -2
  29. package/dist/retrievers/parent_document.cjs +1 -2
  30. package/dist/retrievers/parent_document.d.ts +1 -1
  31. package/dist/retrievers/parent_document.js +1 -2
  32. package/dist/retrievers/remote/chatgpt-plugin.cjs +5 -4
  33. package/dist/retrievers/remote/chatgpt-plugin.d.ts +5 -2
  34. package/dist/retrievers/remote/chatgpt-plugin.js +3 -2
  35. package/dist/retrievers/remote/index.cjs +2 -2
  36. package/dist/retrievers/remote/index.d.ts +1 -1
  37. package/dist/retrievers/remote/index.js +1 -1
  38. package/dist/retrievers/remote/remote-retriever.cjs +3 -2
  39. package/dist/retrievers/remote/remote-retriever.d.ts +3 -1
  40. package/dist/retrievers/remote/remote-retriever.js +2 -1
  41. package/dist/retrievers/vespa.cjs +15 -78
  42. package/dist/retrievers/vespa.d.ts +1 -54
  43. package/dist/retrievers/vespa.js +1 -76
  44. package/dist/schema/runnable/config.d.ts +1 -1
  45. package/dist/util/entrypoint_deprecation.cjs +18 -0
  46. package/dist/util/entrypoint_deprecation.d.ts +5 -0
  47. package/dist/util/entrypoint_deprecation.js +14 -0
  48. package/package.json +2 -2
  49. package/dist/callbacks/handlers/tracer_langchain_v1.cjs +0 -17
  50. package/dist/callbacks/handlers/tracer_langchain_v1.d.ts +0 -1
  51. package/dist/callbacks/handlers/tracer_langchain_v1.js +0 -1
  52. package/dist/retrievers/remote/base.cjs +0 -68
  53. package/dist/retrievers/remote/base.d.ts +0 -60
  54. package/dist/retrievers/remote/base.js +0 -64
@@ -1,60 +0,0 @@
1
- import { BaseRetriever, type BaseRetrieverInput } from "@langchain/core/retrievers";
2
- import { AsyncCaller, AsyncCallerParams } from "../../util/async_caller.js";
3
- import { Document } from "../../document.js";
4
- /**
5
- * Type for the authentication method used by the RemoteRetriever. It can
6
- * either be false (no authentication) or an object with a bearer token.
7
- */
8
- export type RemoteRetrieverAuth = false | {
9
- bearer: string;
10
- };
11
- /**
12
- * Type for the JSON response values from the remote server.
13
- */
14
- export type RemoteRetrieverValues = Record<string, any>;
15
- /**
16
- * Interface for the parameters required to initialize a RemoteRetriever
17
- * instance.
18
- */
19
- export interface RemoteRetrieverParams extends AsyncCallerParams, BaseRetrieverInput {
20
- /**
21
- * The URL of the remote retriever server
22
- */
23
- url: string;
24
- /**
25
- * The authentication method to use, currently implemented is
26
- * - false: no authentication
27
- * - { bearer: string }: Bearer token authentication
28
- */
29
- auth: RemoteRetrieverAuth;
30
- }
31
- /**
32
- * Abstract class for interacting with a remote server to retrieve
33
- * relevant documents based on a given query.
34
- */
35
- export declare abstract class RemoteRetriever extends BaseRetriever implements RemoteRetrieverParams {
36
- get lc_secrets(): {
37
- [key: string]: string;
38
- } | undefined;
39
- url: string;
40
- auth: RemoteRetrieverAuth;
41
- headers: Record<string, string>;
42
- asyncCaller: AsyncCaller;
43
- constructor(fields: RemoteRetrieverParams);
44
- /**
45
- * Abstract method that should be implemented by subclasses to create the
46
- * JSON body of the request based on the given query.
47
- * @param query The query based on which the JSON body of the request is created.
48
- * @returns The JSON body of the request.
49
- */
50
- abstract createJsonBody(query: string): RemoteRetrieverValues;
51
- /**
52
- * Abstract method that should be implemented by subclasses to process the
53
- * JSON response from the server and convert it into an array of Document
54
- * instances.
55
- * @param json The JSON response from the server.
56
- * @returns An array of Document instances.
57
- */
58
- abstract processJsonResponse(json: RemoteRetrieverValues): Document[];
59
- _getRelevantDocuments(query: string): Promise<Document[]>;
60
- }
@@ -1,64 +0,0 @@
1
- import { BaseRetriever, } from "@langchain/core/retrievers";
2
- import { AsyncCaller } from "../../util/async_caller.js";
3
- /**
4
- * Abstract class for interacting with a remote server to retrieve
5
- * relevant documents based on a given query.
6
- */
7
- export class RemoteRetriever extends BaseRetriever {
8
- get lc_secrets() {
9
- return {
10
- "auth.bearer": "REMOTE_RETRIEVER_AUTH_BEARER",
11
- };
12
- }
13
- constructor(fields) {
14
- super(fields);
15
- Object.defineProperty(this, "url", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: void 0
20
- });
21
- Object.defineProperty(this, "auth", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: void 0
26
- });
27
- Object.defineProperty(this, "headers", {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: void 0
32
- });
33
- Object.defineProperty(this, "asyncCaller", {
34
- enumerable: true,
35
- configurable: true,
36
- writable: true,
37
- value: void 0
38
- });
39
- const { url, auth, ...rest } = fields;
40
- this.url = url;
41
- this.auth = auth;
42
- this.headers = {
43
- Accept: "application/json",
44
- "Content-Type": "application/json",
45
- ...(this.auth && this.auth.bearer
46
- ? { Authorization: `Bearer ${this.auth.bearer}` }
47
- : {}),
48
- };
49
- this.asyncCaller = new AsyncCaller(rest);
50
- }
51
- async _getRelevantDocuments(query) {
52
- const body = this.createJsonBody(query);
53
- const response = await this.asyncCaller.call(() => fetch(this.url, {
54
- method: "POST",
55
- headers: this.headers,
56
- body: JSON.stringify(body),
57
- }));
58
- if (!response.ok) {
59
- throw new Error(`Failed to retrieve documents from ${this.url}: ${response.status} ${response.statusText}`);
60
- }
61
- const json = await response.json();
62
- return this.processJsonResponse(json);
63
- }
64
- }