mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
feat: Optimize langchain calls in batching mode (#15011)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -7,6 +7,11 @@ import { makeZodSchemaFromAttributes } from '../helpers';
|
||||
import { InformationExtractor } from '../InformationExtractor.node';
|
||||
import type { AttributeDefinition } from '../types';
|
||||
|
||||
jest.mock('n8n-workflow', () => ({
|
||||
...jest.requireActual('n8n-workflow'),
|
||||
sleep: jest.fn(),
|
||||
}));
|
||||
|
||||
const mockPersonAttributes: AttributeDefinition[] = [
|
||||
{
|
||||
name: 'name',
|
||||
@@ -91,7 +96,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributes,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeLLM({ response: formatFakeLlmResponse({ name: 'John', age: 30 }) }),
|
||||
@@ -111,7 +121,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributes,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeLLM({ response: formatFakeLlmResponse({ name: 'John' }) }),
|
||||
@@ -132,7 +147,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributesRequired,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeLLM({ response: formatFakeLlmResponse({ name: 'John' }) }),
|
||||
@@ -154,7 +174,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributes,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeLLM({ response: formatFakeLlmResponse({ name: 'John', age: '30' }) }),
|
||||
@@ -175,7 +200,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributesRequired,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeListChatModel({
|
||||
@@ -200,7 +230,12 @@ describe('InformationExtractor', () => {
|
||||
attributes: {
|
||||
attributes: mockPersonAttributesRequired,
|
||||
},
|
||||
options: {},
|
||||
options: {
|
||||
batching: {
|
||||
batchSize: 1,
|
||||
delayBetweenBatches: 100,
|
||||
},
|
||||
},
|
||||
schemaType: 'fromAttributes',
|
||||
},
|
||||
new FakeListChatModel({
|
||||
|
||||
Reference in New Issue
Block a user