Skip to content

Commit 7f6a1df

Browse files
lh0x00arielweinberger
authored andcommitted
feat: allows merging pezzo options with openai options (#270)
* feat: allows merging pezzo options with openai options * chore: move `openaiOptions` to 3rd parameter instead of merge with `pezzoOptions` * chore: delete `yarn.lock` file * chore: format code * chore: make 3rd parameter is optional
1 parent f3ae86b commit 7f6a1df

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

libs/client/src/client/PezzoOpenAI.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ class Completions {
4949

5050
async create(
5151
_arg1: PezzoCreateChatCompletionRequest | OpenAIChatCompletionCreateParams,
52-
optionsOrPezzoProps:
53-
| Parameters<OpenAI["chat"]["completions"]["create"]>[1]
54-
| PezzoProps = {}
52+
pezzoOptions: PezzoProps = {},
53+
openaiOptions?: Parameters<OpenAI["chat"]["completions"]["create"]>[1]
5554
): Promise<OpenAI.Chat.ChatCompletion> {
5655
const arg1 = _arg1 as PezzoCreateChatCompletionRequest;
5756

@@ -78,16 +77,6 @@ class Completions {
7877
...nativeOptions,
7978
};
8079

81-
let pezzoOptions: PezzoProps | undefined;
82-
83-
if (
84-
"variables" in optionsOrPezzoProps ||
85-
"properties" in optionsOrPezzoProps ||
86-
"cache" in optionsOrPezzoProps
87-
) {
88-
pezzoOptions = optionsOrPezzoProps as PezzoProps;
89-
}
90-
9180
if (pezzoOptions?.variables) {
9281
const messages = interpolateVariablesRecursively<
9382
OpenAI.Chat.CompletionCreateParams["messages"]
@@ -155,11 +144,7 @@ class Completions {
155144
{
156145
...(requestBody as OpenAI.Chat.CompletionCreateParamsNonStreaming),
157146
},
158-
"variables" in optionsOrPezzoProps
159-
? undefined
160-
: (optionsOrPezzoProps as Parameters<
161-
OpenAI["chat"]["completions"]["create"]
162-
>[1])
147+
openaiOptions
163148
);
164149

165150
reportPayload = {

0 commit comments

Comments
 (0)