BuilderIO / BuilderIO/qwik-docs-es

openai: ^4.24.7 | possible upgrade

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Not so much an issue and I'm not developing qwik-docs-es. I was looking through this to find a way to use openai in qwik, I noticed this version is pre openai 4.0 ( which got revamped SDK ), not sure if you even care about updating it to use the new SDK methods. which would just change the custom fetch methods

embedding:
ref: https://platform.openai.com/docs/api-reference/embeddings/create
__
https://github.com/BuilderIO/qwik-docs-es/blob/main/src/components/qwik-gpt/search.tsx#L11

_
chat completions :
ref: https://platform.openai.com/docs/api-reference/streaming
__
https://github.com/BuilderIO/qwik-docs-es/blob/main/src/components/qwik-gpt/search.tsx#L77-L95

https://github.com/BuilderIO/qwik-docs-es/blob/main/src/components/qwik-gpt/streaming-gpt.ts#L1-L19
_

Don't have to refactor anything its basically the same and could just continue to use the fetch that you have and all that would need is to changed is the type in:
https://github.com/BuilderIO/qwik-docs-es/blob/main/src/components/qwik-gpt/streaming-gpt.ts#L1-L19

possible upgrade ( unless I missed another type somewhere ), if not the qwik-gpt/search.tsx throws a namespace type error,
By just modifying it to this :

```

import type OpenAI from "openai";

export async function* chatCompletion(apiKey: string, request: OpenAI.Chat.ChatCompletionCreateParams) {...

```

v4.0+ the request types change
ref:
https://github.com/openai/openai-node?tab=readme-ov-file#request--response-types

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.