@owlworks/florence-api
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -78,2 +78,3 @@ export interface IS3Configuration { | ||
query: string; | ||
previous_contexts?: string[]; | ||
} | ||
@@ -84,6 +85,7 @@ export interface ISQLQueryContext { | ||
datasourceId: string; | ||
previous_contexts?: string[]; | ||
} | ||
export interface IGeneratedSQL { | ||
sql: string; | ||
contexts?: string[]; | ||
previous_contexts?: string[]; | ||
} | ||
@@ -102,3 +104,3 @@ export interface IOptions { | ||
constructor(options: IOptions); | ||
ask(datasourceId: string, query: string, contexts?: string[]): Promise<IGeneratedSQL>; | ||
ask(datasourceId: string, query: string, previous_contexts?: string[]): Promise<IGeneratedSQL>; | ||
addDatasource(datasourceName: string, datasourceType: string, ddl: string, glossary: string): Promise<IDataSource>; | ||
@@ -105,0 +107,0 @@ datasources(): Promise<IDataSources>; |
@@ -32,4 +32,4 @@ "use strict"; | ||
} | ||
async ask(datasourceId, query, contexts) { | ||
if (contexts && contexts.length > Florence.ALLOWED_CONTEXTS_SIZE) { | ||
async ask(datasourceId, query, previous_contexts) { | ||
if (previous_contexts && previous_contexts.length > Florence.ALLOWED_CONTEXTS_SIZE) { | ||
throw new Error(`Maximum of ${Florence.ALLOWED_CONTEXTS_SIZE} contexts are allowed.`); | ||
@@ -41,3 +41,4 @@ } | ||
datasourceId: datasourceId, | ||
query: query | ||
query: query, | ||
previous_contexts: previous_contexts | ||
}; | ||
@@ -111,3 +112,4 @@ return this.getSql(context); | ||
const sqlgenerationContext = { | ||
query: context.query | ||
query: context.query, | ||
previous_contexts: context.previous_contexts | ||
}; | ||
@@ -114,0 +116,0 @@ const response = await axios_1.default.post(`${this.apiUrl}/sql/${tenantId}/${datasourceId}`, sqlgenerationContext, { |
@@ -44,3 +44,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "0.2.0" | ||
"version": "0.3.0" | ||
} |
10987
281