Skip to content

Commit

Permalink
- add jsdoc
Browse files Browse the repository at this point in the history
-- remove log
-- validate chat_history services
  • Loading branch information
Joao Paulo Nobrega committed Nov 11, 2024
1 parent 2b10a93 commit 8689884
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
9 changes: 9 additions & 0 deletions src/interface/agent.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ export interface IVectorStoreConfig {
top?: number;
}

/**
* Configuration interface for a monitor.
*
* @interface IMonitorConfig
* @property {MONITOR_TYPE} type - The type of the monitor.
* @property {string} apiKey - The API key used for authentication.
* @property {string} projectName - The name of the project being monitored.
* @property {string} endpoint - The endpoint URL for the monitor.
*/
export interface IMonitorConfig {
type: MONITOR_TYPE;
apiKey: string;
Expand Down
2 changes: 0 additions & 2 deletions src/services/chain/openapi-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class OpenAPIChain implements IChain {
}

private async executeOpenAPI(input: any) {
console.log('input', input);

return new Promise((resolve, reject) => {
try {
const curl = this.parserCurl(input?.curl?.content);
Expand Down
7 changes: 4 additions & 3 deletions src/services/chat-history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ const Services = {

class ChatHistoryFactory {
public static async create(settings: IDatabaseConfig): Promise<IChatHistory> {
const service = new Services[settings?.type](settings);
const Service = Services[settings?.type];
// new Services[settings?.type](settings);

if (!service) {
if (!Service) {
return await new MemoryChatHistory(settings).build();
}

return await service.build();
return await new Service(settings).build();
}
}

Expand Down
8 changes: 5 additions & 3 deletions tests/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Agent from '../src/agent';
import { DataSource } from 'typeorm';
import { IAgentConfig } from '../src/interface/agent.interface';

const agentConfig = require(`./agent-configs/agent-openapi.json`);
const agentConfig = require(`./agent-configs/agent-cru.json`);

describe('Agent test', () => {
it('should Agent instance', (t, done) => {
Expand All @@ -26,7 +26,7 @@ describe('Agent test', () => {
done();
});

it.skip('should Agent call', (t, done) => {
it('should Agent call', (t, done) => {
const agentSettings = agentConfig as unknown as IAgentConfig;

if (agentSettings.dataSourceConfig) {
Expand Down Expand Up @@ -55,7 +55,9 @@ describe('Agent test', () => {
});

agent.call({
question: 'Qual estoque do produto 2771?',
question: 'Quem ganhou a ultima copa do mundo?',
// question: 'Limpar o cache da pessoa a443bf0e-4c76-42f8-a084-c6544309f111?',
// question: 'Qual estoque do produto 2771?',
// question: 'O que preciso fazer para reprocessear um pedido SAC?',
// question: 'qUAL MINHAS VISITAS AMANHA?',
chatThreadID: '11',
Expand Down

0 comments on commit 8689884

Please sign in to comment.