[Workers AI] Undefined result for models that return binary output

オープン
#2,695 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
ai, api

調査の方向性

Start at the client.ai.run entry point shown in the reproduction and trace how responses are handled for the binary-output model versus the base64-string model. Run the provided snippet against leonardo/phoenix-1.0 and confirm that the binary result is returned instead of undefined; add coverage for this behavior if the surrounding code has tests.

索引モデルが issue の本文から書いたものです。

説明

kind: bug
Confirm this is a Typescript library issue and not an underlying Cloudflare API issue
  • This is an issue with the Typescript library
Describe the bug

Hello!

I can't tell if I'm holding the SDK wrong, but when I use the Typescript SDK to run a model like leonardo/phoenix-1.0 that, according to the docs, returns the following payload...

{
  "type": "string",
  "contentType": "image/jpeg",
  "format": "binary",
  "description": "The generated image in JPEG format"
}

...I get an undefined output. If I run a model that returns a base64 string (like schnell), I get back a JSON object that correctly reflects the type that's in the documentation.

What could I be doing wrong?

To Reproduce

Run this snippet:

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const output = await client.ai.run("@cf/leonardo/phoenix-1.0", {
  prompt: "A cat eating soup dumplings",
  account_id: process.env['CLOUDFLARE_ACCOUNT_ID']!,
}) 
console.log('Output type:', typeof output);
console.log('Output:', output);

Observe this output:

Output type: undefined
Output: undefined
Code snippets

OS

macOS

Runtime version

Typescript 5.7.3

Library version

v5.2.0

主要言語
TypeScript
スター
835
フォーク
201
平均マージ
41分
マージ済み PR(30日)
1

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudflare/cloudflare-typescript のほかの issue

cloudflare/cloudflare-typescript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。