Upgrades leave old two-parameter openai_compatible_generate[_json] overloads, and two-argument calls still run the old code
まだ誰も着手していません。
評価
調査の方向性
src/openai_compatible/generate.sqlから始め、2つの関数定義の前にあるクリーンアップブロックを読んでください。IBM iでQSYS2.SYSROUTINESが特定名とパラメーター数をどのように報告するかを確認し、再構築後に4パラメーターのルーチンだけが残り、2引数の呼び出しが現在の実装を使用することを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Upgrading an existing installation leaves the old two-parameter versions of openai_compatible_generate and openai_compatible_generate_json in DBSDK_V1. Two-argument calls keep running that old code.
Observed
On an IBM i system that had an earlier version of the toolkit installed, rebuilding the current source left both versions of each function:
| Routine | Specific name | Parameters | Created |
|---|---|---|---|
OPENAI_COMPATIBLE_GENERATE |
OPENAI_COMPATIBLE_GENERATE |
2 | 2025-07-10 |
OPENAI_COMPATIBLE_GENERATE |
OPENA00001 |
4 | current build |
OPENAI_COMPATIBLE_GENERATE_JSON |
OPENAI_COMPATIBLE_GENERATE_JSON |
2 | 2025-05-12 |
OPENAI_COMPATIBLE_GENERATE_JSON |
OPENA00002 |
4 | current build |
A call such as openai_compatible_generate('prompt', '{}') resolves to the exact two-parameter match, which is the 2025 code. In this case the old code built the URL without the configured port, so it failed with "Failed to open connection to server at host localhost and port 80". Calls with three or four arguments use the current code, so the behavior depends on how a function is called.
Cause
create or replace function replaces a function only when the parameter list matches. When the parameter list changed, the build added a new overload instead.
Fix
At the top of src/openai_compatible/generate.sql, drop every version of the two functions that doesn't take four parameters, before creating the current ones. On a fresh install this finds nothing. The note is a block comment so that the docs generator, which copies -- lines, leaves it out.
This was verified on IBM i 7.5: after a rebuild, only the two four-parameter functions remain, and two-argument calls use the current code. The change:
--- a/src/openai_compatible/generate.sql
+++ b/src/openai_compatible/generate.sql
@@ -1,5 +1,24 @@
-- ## OpenAI-compatible endpoints main functionality
+/*
+ Earlier versions of the toolkit defined openai_compatible_generate and
+ openai_compatible_generate_json with two parameters. "create or replace" with a different
+ parameter list adds an overload instead of replacing it, and two-argument calls would keep
+ resolving to the old version, so remove any versions that do not take four parameters.
+ (A block comment, so the docs generator, which copies "-- " lines, leaves it out.)
+*/
+begin
+ for old_routine as
+ select specific_name
+ from qsys2.sysroutines
+ where routine_schema = 'DBSDK_V1'
+ and routine_name in ('OPENAI_COMPATIBLE_GENERATE', 'OPENAI_COMPATIBLE_GENERATE_JSON')
+ and in_parms <> 4
+ do
+ execute immediate 'drop specific function dbsdk_v1.' concat old_routine.specific_name;
+ end for;
+end;
+
-- #### **Function:** `openai_compatible_generate`
-- **Description:** Uses OpenAI-compatible API to generate a reply to the given prompt
- 主要言語
- RPGLE
- スター
- 13
- フォーク
- 7
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
IBM/AI-SQL-Toolkit-IBMi のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
IBM/AI-SQL-Toolkit-IBMi#54 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
IBM/AI-SQL-Toolkit-IBMi#51 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
IBM/AI-SQL-Toolkit-IBMi#50 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
IBM/AI-SQL-Toolkit-IBMi#48 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 73/100
IBM/AI-SQL-Toolkit-IBMi#52 ·
IBM/AI-SQL-Toolkit-IBMi の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
priority: low python
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
LearningCircuit/local-deep-research#8635 ·
メンテナーはふだん 1 日以内に返信
-
priority: low ☕️ type: bug 🐛
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
peasant-labs/peasant#993 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
config-report via-web
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
ch-bas/cctv-camera-database#430 ·