approvers / ichiyoAI

ChatGPT / Gemini / DALL-E が利用できる Discord Bot
http://ichiyoai.approvers.dev/
MIT License
6 stars 2 forks source link

Gemini に関するリクエストが部分的にうまく行かない #208

Open nanai10a opened 4 months ago

nanai10a commented 4 months ago

formal な詳細提供は保留しています


このようなエラーが表示される

image

Gemini は確かに messages の両端がユーザロールでない場合 (つまり LLM 側) に生成を拒否する仕様なのだが, どうにもユーザのメッセージを 2 つ繋げただけでもエラーが出力されている様子.

推測しているのは, 奇数個のメッセージ長さでないといけないか, 同一ロールのメッセージを連続して配置できないかのどちらかではないかと考えている.


ざっくりやること

m1sk9 commented 4 months ago
2024-02-15T13:34:29.210400Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:34:29.210868Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:34:39.197902Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:34:39.198202Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:38:30.123614Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:38:30.123890Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:40:33.421981Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:40:33.422277Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T14:34:30.149934Z  INFO run:recv_event:handle_event:handle_gateway_dispatch: serenity::gateway::shard: [ShardInfo { id: ShardId(0), total: 1 }] Resumed event=Ok(Dispatch(5354, Resumed(ResumedEvent))) seq=5354 event=Resumed(ResumedEvent)
m1sk9 commented 4 months ago
2024-02-15T13:34:29.210400Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:34:29.210868Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:34:39.197902Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:34:39.198202Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:38:30.123614Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:38:30.123890Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T13:40:33.421981Z  WARN interaction_create:completion:next: ichiyo_ai::google: Unexpected status code res.status=400
2024-02-15T13:40:33.422277Z ERROR interaction_create:completion:next: ichiyo_ai::google: Receive error response error=Error { code: 400, message: "Please ensure that multiturn requests ends with a user role or a function response.", status: Lhs(InvalidArgument) }
2024-02-15T14:34:30.149934Z  INFO run:recv_event:handle_event:handle_gateway_dispatch: serenity::gateway::shard: [ShardInfo { id: ShardId(0), total: 1 }] Resumed event=Ok(Dispatch(5354, Resumed(ResumedEvent))) seq=5354 event=Resumed(ResumedEvent)

Containers2 は Docker Swarm なのでもうちょっとログを出すことも出来るけど, 情報量はそうでもないね. ログシステムもう少し強化したいところではある

nanai10a commented 4 months ago

ロギングに関して言えば, 何処のコードでどうエラーが出たのかを追えるような感じに留めていて, ログとコード併せて読むものという風にしているので… それ以上にする気持ちはありません (がそれに於いて必要な加筆修正には前向きです).