-
Notifications
You must be signed in to change notification settings - Fork 117
feat: end-to-end OpenAI Image Generation support #1280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 122 commits
d2a8238
d437517
f14724b
57221d1
dba1989
cffb9cd
c041ff1
89bc99d
2ae8746
fe43a82
309ef40
0344926
32ce458
cd8fef4
8533378
1b96d5d
2d01dee
70613ad
3df1d05
b5ed37c
d41fc34
bb0b50c
8b6a8ce
9acb6e0
9d64bdf
10680e0
3f10c30
6519927
d3ff4ff
0d73e09
ef4e0b1
09bf4c7
7b55cbc
89c83cb
d5d89ca
37b358b
1c30a22
9d73117
36e4793
91ad9bf
70d09c0
2d22b18
da2622b
a4e904a
88b2465
c723caa
0abf064
f36b7d2
bc72988
35a2434
0221b8a
f348973
e4dffe6
23236c8
1e826f6
4ae452f
e2d32a1
d1274f0
98b9cd0
d117c71
b2738f2
cf5362f
ccf4363
0afc3b8
7f57409
a290878
40f195a
b99b923
11cdf26
f42a731
1cac2de
d297900
dbc5000
ee25037
3fb95f0
498172d
e7d71af
9d38e2d
61185f3
1d2839f
9ed5b2e
7d3200c
55b00b7
3633b8f
7c95a1d
a73b70f
3ab4ec5
790508f
dd65197
f3386f7
7e8c0bb
90b4eb8
dccbce2
e6c1b62
6014aad
0e28416
1f58846
b6fafe9
522b36f
4331f2c
74bf967
3b94cce
d9ef8fd
618505e
6b537a3
7314a8a
1ec80f5
7d8bc39
27dfe48
4b38b27
67bd662
48d6abb
4e24c3c
55a34f5
6afd3ed
aef452b
01a6cc1
a0edec0
11acc32
c3e078e
e81223a
39bd095
7fa70f0
6f5f8d5
716c31d
3889088
5ea089e
66eb0b7
3fb4f0e
b7af1cc
b96aa89
e0ff580
949a70a
e88071d
c955e6f
2d25398
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,3 +49,4 @@ inference-extension-conformance-test-report.yaml | |
| .mcp.json | ||
|
|
||
| .goose | ||
| /aigw | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,7 @@ func TestReadConfig(t *testing.T) { | |
| // Clear any existing env vars | ||
| t.Setenv("OPENAI_API_KEY", "") | ||
| t.Setenv("OPENAI_BASE_URL", "") | ||
| t.Setenv("AZURE_OPENAI_API_KEY", "") | ||
|
||
|
|
||
| for k, v := range tt.envVars { | ||
| t.Setenv(k, v) | ||
|
|
@@ -104,6 +105,9 @@ func TestReadConfig(t *testing.T) { | |
| } | ||
|
|
||
| t.Run("error when file and no OPENAI_API_KEY", func(t *testing.T) { | ||
| // Ensure both OpenAI and Azure keys are unset so readConfig errors | ||
| t.Setenv("OPENAI_API_KEY", "") | ||
| t.Setenv("AZURE_OPENAI_API_KEY", "") | ||
| _, err := readConfig("", nil, false) | ||
| require.Error(t, err) | ||
| require.EqualError(t, err, "you must supply at least OPENAI_API_KEY or AZURE_OPENAI_API_KEY or a config file path") | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -123,24 +123,6 @@ services: | |||||||||||||||||||||||||||||||||||
| - OPENAI_BASE_URL=http://aigw:1975/v1 | ||||||||||||||||||||||||||||||||||||
| - OPENAI_API_KEY=unused | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # completion is the standard OpenAI client (`openai` in pip), instrumented | ||||||||||||||||||||||||||||||||||||
| # with the following OpenTelemetry instrumentation libraries: | ||||||||||||||||||||||||||||||||||||
| # - openinference-instrumentation-openai (completions spans) | ||||||||||||||||||||||||||||||||||||
| # - opentelemetry-instrumentation-httpx (HTTP client spans and trace headers) | ||||||||||||||||||||||||||||||||||||
| completion: | ||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||
| context: ../../tests/internal/testopeninference | ||||||||||||||||||||||||||||||||||||
| dockerfile: Dockerfile.openai_client | ||||||||||||||||||||||||||||||||||||
| target: completion | ||||||||||||||||||||||||||||||||||||
| container_name: completion | ||||||||||||||||||||||||||||||||||||
| profiles: ["test"] | ||||||||||||||||||||||||||||||||||||
| env_file: | ||||||||||||||||||||||||||||||||||||
| - ../../.env.ollama | ||||||||||||||||||||||||||||||||||||
| - .env.otel.${COMPOSE_PROFILES:-console} | ||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||
| - OPENAI_BASE_URL=http://aigw:1975/v1 | ||||||||||||||||||||||||||||||||||||
| - OPENAI_API_KEY=unused | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
126
to
142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not delete irrelevant thing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you not lie ? ai-gateway/cmd/aigw/docker-compose-otel.yaml Lines 126 to 142 in 8ee7ae1
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad, i think i was referring old file |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # mcp is a test client for calling MCP tools through aigw. | ||||||||||||||||||||||||||||||||||||
| # TODO: add client tracing + mcp propagation to this | ||||||||||||||||||||||||||||||||||||
| mcp: | ||||||||||||||||||||||||||||||||||||
|
|
@@ -162,3 +144,21 @@ services: | |||||||||||||||||||||||||||||||||||
| - flyTo=LAX | ||||||||||||||||||||||||||||||||||||
| - --tool-arg | ||||||||||||||||||||||||||||||||||||
| - departureDate=15/12/2025 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # image-generation is a simple curl-based test client for sending image | ||||||||||||||||||||||||||||||||||||
| # generation requests to aigw. | ||||||||||||||||||||||||||||||||||||
| image-generation: | ||||||||||||||||||||||||||||||||||||
| image: golang:1.25 | ||||||||||||||||||||||||||||||||||||
| container_name: image-generation | ||||||||||||||||||||||||||||||||||||
| profiles: ["test"] | ||||||||||||||||||||||||||||||||||||
| env_file: | ||||||||||||||||||||||||||||||||||||
| - ../../.env.ollama | ||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||
| - sh | ||||||||||||||||||||||||||||||||||||
| - -c | ||||||||||||||||||||||||||||||||||||
| - | | ||||||||||||||||||||||||||||||||||||
| curl -s -w %{http_code} \ | ||||||||||||||||||||||||||||||||||||
| -X POST http://aigw:1975/v1/images/generations \ | ||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer unused" \ | ||||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||
| -d "{\"model\":\"$$IMAGE_GENERATION_MODEL\",\"prompt\":\"A watercolor painting of a red fox in a birch forest\",\"size\":\"1024x1024\",\"quality\":\"low\"}" | ||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ Flags: | |
| { | ||
| name: "run no arg", | ||
| args: []string{"run"}, | ||
| env: map[string]string{"OPENAI_API_KEY": "", "AZURE_OPENAI_API_KEY": ""}, | ||
|
||
| rf: func(context.Context, cmdRun, runOpts, io.Writer, io.Writer) error { return nil }, | ||
| expPanicCode: ptr.To(80), | ||
| }, | ||
|
|
@@ -190,6 +191,9 @@ func TestCmdRun_Validate(t *testing.T) { | |
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| // Ensure a clean environment for validation. | ||
| t.Setenv("OPENAI_API_KEY", "") | ||
| t.Setenv("AZURE_OPENAI_API_KEY", "") | ||
| for k, v := range tt.envVars { | ||
| t.Setenv(k, v) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this Ollama?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this wont work, but there is no image gen model available with ollma