Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
deekshas8 committed Sep 2, 2024
1 parent 29f7252 commit d853fd6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/gen-ai-hub/src/client/openai/openai-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
parseMockResponse
} from '../../../../../test-util/mock-http.js';
import {
OpenAiChatCompletionOutput,
OpenAiChatMessage,
OpenAiEmbeddingOutput,
OpenAiEmbeddingParameters
} from './openai-types.js';
import { OpenAiClient } from './openai-client.js';
import { OpenAiChatCompletionResponse } from './openai-response.js';

describe('openai client', () => {
const chatCompletionEndpoint = {
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('openai client', () => {
] as OpenAiChatMessage[]
};

const mockResponse = parseMockResponse<OpenAiChatCompletionOutput>(
const mockResponse = parseMockResponse<OpenAiChatCompletionResponse>(
'openai',
'openai-chat-completion-success-response.json'
);
Expand All @@ -62,7 +62,7 @@ describe('openai client', () => {
const response = await client.chatCompletion(prompt, {
deploymentId: '1234'
});
expect(response).toEqual(mockResponse);
expect(response).toEqual(mockResponse.data);
});

it('throws on bad request', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/gen-ai-hub/src/client/openai/openai-response.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { HttpResponse } from "@sap-cloud-sdk/http-client";
import { OpenAiChatCompletionOutput } from "./openai-types.js";

// Define a wrapper class to expose utility methods and properties
/**
* Open AI chat completion response.
*/
export class OpenAiChatCompletionResponse {
public data: OpenAiChatCompletionOutput
constructor(private rawResponse: HttpResponse,) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { HttpResponse } from "@sap-cloud-sdk/http-client";
import { CompletionPostResponse } from "./client/api/schema/index.js";

// Define a wrapper class to expose utility methods and properties
/**
* Respresentation of Orchestration response.
*/
export class OrchestrationResponse {
public data: CompletionPostResponse
constructor(private rawResponse: HttpResponse,) {
Expand Down

0 comments on commit d853fd6

Please sign in to comment.