Skip to content

Commit

Permalink
feat: change /_plugins/_ml to a constant
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Dec 1, 2023
1 parent 5ca502e commit 34c6e9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion server/services/chat/olly_chat_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LLMModelFactory } from '../../olly/models/llm_model_factory';
import { PPLTools } from '../../olly/tools/tool_sets/ppl';
import { PPLGenerationRequestSchema } from '../../routes/langchain_routes';
import { ChatService } from './chat_service';
import { ML_COMMONS_BASE_API } from '../../olly/models/constants';

const MEMORY_ID_FIELD = 'memory_id';

Expand Down Expand Up @@ -49,7 +50,7 @@ export class OllyChatService implements ChatService {
}
const agentFrameworkResponse = (await opensearchClient.transport.request({
method: 'POST',
path: `/_plugins/_ml/agents/${rootAgentId}/_execute`,
path: `${ML_COMMONS_BASE_API}/agents/${rootAgentId}/_execute`,
body: {
parameters: parametersPayload,
},
Expand Down
13 changes: 7 additions & 6 deletions server/services/storage/agent_framework_storage_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { GetSessionsSchema } from '../../routes/chat_routes';
import { StorageService } from './storage_service';
import { MessageParser } from '../../types';
import { MessageParserRunner } from '../../utils/message_parser_runner';
import { ML_COMMONS_BASE_API } from '../../olly/models/constants';

export interface SessionOptResponse {
success: boolean;
Expand All @@ -33,15 +34,15 @@ export class AgentFrameworkStorageService implements StorageService {
const [interactionsResp, conversation] = await Promise.all([
this.client.transport.request({
method: 'GET',
path: `/_plugins/_ml/memory/conversation/${sessionId}/_list`,
path: `${ML_COMMONS_BASE_API}/memory/conversation/${sessionId}/_list`,
}) as TransportRequestPromise<
ApiResponse<{
interactions: Interaction[];
}>
>,
this.client.transport.request({
method: 'GET',
path: `/_plugins/_ml/memory/conversation/${sessionId}`,
path: `${ML_COMMONS_BASE_API}/memory/conversation/${sessionId}`,
}) as TransportRequestPromise<
ApiResponse<{
conversation_id: string;
Expand Down Expand Up @@ -103,7 +104,7 @@ export class AgentFrameworkStorageService implements StorageService {

const sessions = await this.client.transport.request({
method: 'GET',
path: `/_plugins/_ml/memory/conversation/_search`,
path: `${ML_COMMONS_BASE_API}/memory/conversation/_search`,
body: requestParams,
});

Expand Down Expand Up @@ -142,7 +143,7 @@ export class AgentFrameworkStorageService implements StorageService {
try {
const response = await this.client.transport.request({
method: 'DELETE',
path: `/_plugins/_ml/memory/conversation/${sessionId}/_delete`,
path: `${ML_COMMONS_BASE_API}/memory/conversation/${sessionId}/_delete`,
});
if (response.statusCode === 200) {
return {
Expand All @@ -164,7 +165,7 @@ export class AgentFrameworkStorageService implements StorageService {
try {
const response = await this.client.transport.request({
method: 'PUT',
path: `/_plugins/_ml/memory/conversation/${sessionId}/_update`,
path: `${ML_COMMONS_BASE_API}/memory/conversation/${sessionId}/_update`,
body: {
name: title,
},
Expand All @@ -189,7 +190,7 @@ export class AgentFrameworkStorageService implements StorageService {
try {
const response = (await this.client.transport.request({
method: 'GET',
path: `/_plugins/_ml/memory/trace/${interactionId}/_list`,
path: `${ML_COMMONS_BASE_API}/memory/trace/${interactionId}/_list`,
})) as ApiResponse<{
traces: Array<{
conversation_id: string;
Expand Down

0 comments on commit 34c6e9c

Please sign in to comment.