File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/core/src/tracing/openai Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -90,11 +90,14 @@ export function isResponsesApiResponse(response: unknown): response is OpenAIRes
9090 * Check if response is an Embeddings API object
9191 */
9292export function isEmbeddingsResponse ( response : unknown ) : response is OpenAICreateEmbeddingsObject {
93+ if ( response === null || typeof response !== 'object' || ! ( 'object' in response ) ) {
94+ return false ;
95+ }
96+ const responseObject = response as Record < string , unknown > ;
9397 return (
94- response !== null &&
95- typeof response === 'object' &&
96- 'object' in response &&
97- ( response as Record < string , unknown > ) . object === 'list'
98+ responseObject . object === 'list' &&
99+ typeof responseObject . model === 'string' &&
100+ ( responseObject . model as string ) . toLowerCase ( ) . includes ( 'embedding' )
98101 ) ;
99102}
100103
You can’t perform that action at this time.
0 commit comments