-   Notifications  
You must be signed in to change notification settings  - Fork 2k
 
Add OpenAI's Image edit feature #2914
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
Add OpenAI's Image edit feature #2914
Conversation
| return "image.png"; | ||
| } | ||
| }; | ||
| multipartBody.add("image", imageResource); | 
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.
If the user uploads multiple files, the API throws an exception, so you need to change to "image[]"
|   Can ByteArrayResource be modified into InputStreamResource? To prevent OOM exceptions, or do not limit the image type, use the Resource interface directly and let users choose the implementation of Resource.  |  
- spring-projects#2914 (comment) - Change field key image to image[]
| Resource imageResource = new ByteArrayResource(image) { | ||
| @Override | ||
| public String getFilename() { | ||
| return "image.png"; | 
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.
Not all files come with the PNG extension, and the name should be unique per request.
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ient Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- Move evaluation core classes (Request, Response, Evaluator) to spring-ai-commons. - Move chat-specific evaluators (FactChecking, Relevancy) to spring-ai-client-chat#evaluation package. - Move OutputConverter implementations and related classes to spring-ai-model#converter package. - Move MetadataEnricher transformer classes to spring-ai-model#transformer package. - Move PromptAssert utility to spring-ai-rag#util package. - Update relevant pom.xml files and adjust imports in affected classes. - Document class movements in upgrade-notes.adoc for M8 release. This refactoring improves module organization and separation of concerns. Signed-off-by: Mark Pollack <mark.pollack@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…, which defaults to false. When enabled, it skips validation of built-in functions in the template, preventing these built-in functions from being validated as variables to be replaced. Signed-off-by: Sun Yuhan <1085481446@qq.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…r to supportStFunctions. - Add javadocs Signed-off-by: Sun Yuhan <1085481446@qq.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Add repository element to the distributionManagement for Spring AI BOM Add sonatype profile to Spring AI BOM Add developer info to Spring AI BOM Remove javadoc skip at spring-ai-spring-boot-testcontainers POM Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ports Enhance MCP client transports with configurable SSE endpoint support: - Add sseEndpoint parameter to SseParameters record - Update HttpClientSseClientTransport to use builder pattern with sseEndpoint support - Update WebFluxSseClientTransport to use builder pattern with sseEndpoint support - Set default SSE endpoint to /sse when not explicitly configured - Add tests for MCP client properties - Enhance MCP client transport tests and refactor config Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- Prevent projects depending on `mcp-server-webmvc` or `mcp-server-webflux` from exceptions when `spring.ai.mcp.server.enabled` is set to `false`. - Add unit tests to verify. Signed-off-by: YunKui Lu <luyunkui95@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- Add new connections.[name].sse-endpoint property with default value /sse - Update table format to include default values column - Clarify that connections.[name].url is a base URL endpoint Related to spring-projects#2724 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Add unit tests to verify that the WebFlux server transport is properly configured with a custom ObjectMapper that ignores unknown properties. This ensures that the MCP server can handle JSON payloads containing fields not defined in the model classes, which is important for forward compatibility. Signed-off-by: Hari Ohm Prasath <hariohmprasath@gmail.com> Signed-off-by: Hari Ohm Prasth Rajagopal <harrajag@amazon.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Output format instructions should not be included until the very last advisor runs, otherwise there's a risk of templating failure if more than one advisor tries to render the prompt template. This change guarantees the output format instructions are always included right before calling the chat model, without the risk of previous advisors interfering with it. Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
This ensures that validation errors are caught early during object construction rather than later when methods are called, providing better error feedback. - Add validation for tool-annotated methods during construction - Validate duplicate tool names in constructor instead of only at getToolCallbacks() time - Add comprehensive test suite for MethodToolCallbackProvider Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…l calling Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
This PR introduces support for streamUsage in the AzureOpenAiChatOptions. - Set com.azure.ai.openai.models.ChatCompletionStreamOptions#includeUsage via AzureOpenAiChatOptions. Additionally: - Updates the unit test AzureOpenAiChatOptionsTests to reflect the changes. - Updates the documentation in azure-openai-chat.adoc. Signed-off-by: Andres da Silva Santos <40636137+andresssantos@users.noreply.github.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- Improve the jsonToStruct method in VertexAiGeminiChatModel to handle JSON arrays in addition to JSON objects. When a JSON array is detected, it's now properly converted to a Protobuf Struct with an items field containing the array elements. - Added test Resolves spring-projects#2647 , spring-projects#2849 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
… properties (spring-projects#2969) Signed-off-by: g00glen00b <4865705+g00glen00b@users.noreply.github.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Fixes: spring-projects#3399 Auto-cherry-pick to 1.0.x Signed-off-by: jonghoonpark <dev@jonghoonpark.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- Set ApiKey as late as possible Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
…where an extra system message was incorrectly added when the system message was not the first one in the message list. Signed-off-by: Sun Yuhan <1085481446@qq.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…doc (spring-projects#3414) Fixes: spring-projects#3414 Auto-cherry-pick to 1.0.x Signed-off-by: YunKui Lu <luyunkui95@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…video modalities docs (spring-projects#3413) Fixes: 3413 Auto-cherry-pick to 1.0.x Signed-off-by: punnapavankumar9 <punnapavankumar9@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ts#3408) Fixes: spring-projects#3408 Auto-cherry-pick to 1.0.x Signed-off-by: YunKui Lu <luyunkui95@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ryUtils#ResponseErrorHandler Fixes: spring-projects#3415 - Remove @OverRide annotation from handleError(ClientHttpResponse) method to support compilation against both Spring 6.2.x and 7.x - Add delegation from new handleError(URI, HttpMethod, ClientHttpResponse) method to maintain backward compatibility - Preserve existing error handling logic This change allows Spring AI to work seamlessly across Spring Framework versions 6.x and 7.x without requiring reflection or version detection at runtime. Signed-off-by: Soby Chacko <soby.chacko@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
… request Fixes spring-projects#3365 - Set ApiKey as late as possible Auto-cherry-pick to 1.0.x Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Fixes: 3433 Auto-cherry-pick to 1.0.x Signed-off-by: Jan-Eric Harnack <janericharnack@googlemail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…t. (spring-projects#3434) Fixes: spring-projects#3354 Auto-cherry-pick to 1.0.x Signed-off-by: jonghoonpark <dev@jonghoonpark.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…3431) Auto-cherry-pick to 1.0.x Signed-off-by: SexyProgrammer <49146257+SexyProgrammer@users.noreply.github.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ectorStore. (spring-projects#3435) Auto-cherry-pick to 1.0.x Signed-off-by: Sun Yuhan <1085481446@qq.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
In cases where no custom size is set, derive the size by the given embedding model. Had to migrate the embeddingDimension Spring Boot property from int to Integer to introduce the null check for the fluent config. Everything else would have been just noisy. Auto-cherry-pick to 1.0.x Fixes spring-projects#977 Signed-off-by: Gerrit Meier <meistermeier@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Unit test to veriy OpenAiChatOptions.fromOptions.webSearchOptions Fixes: 3377 Auto-cherry-pick to 1.0.x Signed-off-by: lambochen <lambochen@yeah.net> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ums (spring-projects#3411) * feat(openai): for tts and chat completions update supported voices enums Fixes: spring-projects#3411 Auto-cherry-pick to 1.0.x Signed-off-by: punnapavankumar9 <punnapavankumar9@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Auto-cherry-pick to 1.0.x Signed-off-by: jonghoonpark <dev@jonghoonpark.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…ing-projects#3448) - Enclosed debug logging statements within an isDebugEnabled() check - Reduced unnecessary method calls and object creations when debug logging is disabled Auto-cherry-pick to 1.0.x Signed-off-by: Ahoo Wang <ahoowang@qq.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
The dependency on spring-webflux was unnecessary, there was no code inside spring-ai-retry that made use of it. Also remove 'optional' from slf4j-api dependency (it's not optional, if you don't have it on classpath, RetryUtils will fail to load). Add explicit dependency on spring-webflux for modules that directly import WebClient. Auto-cherry-pick to 1.0.x Fixes spring-projects#3307 Signed-off-by: Piotr Kubowicz <piotr.kubowicz@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Qdrant does not support java.lang.Long as a native payload type. Previously, passing a Long value caused the following exception: java.lang.IllegalArgumentException: Unsupported Qdrant value type: class java.lang.Long at org.springframework.ai.vectorstore.qdrant.QdrantValueFactory.value(QdrantValueFactory.java:85) at org.springframework.ai.vectorstore.qdrant.QdrantValueFactory.lambda$toValueMap$1(QdrantValueFactory.java:46) ... To resolve this, Long values are now converted to their String representation in QdrantValueFactory. This preserves precision and avoids serialization issues. test(qdrant): add test to verify Long metadata values are stored as String Adds a test to ensure that Long values in document metadata are safely converted to String before being stored in Qdrant. The test inserts a document with a Long-type "ref_id", performs a similarity search, and verifies that: - the result is not empty, - the retrieved "ref_id" is a String, - the value matches the original Long when parsed. Also ensures cleanup by deleting the inserted document from the store. Auto-cherry-pick to 1.0.x Signed-off-by: Solomon Hsu <solnone@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
* fix:Typo cloud bindings doc Auto-cherry-pick to 1.0.x Signed-off-by: chainHo <chainhou@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
…g-projects#3465) Currently, spring-ai-spring-boot-testcontainers module brings auto-configuration modules plus other dependencies which are unnecessary. Auto-cherry-pick to 1.0.x Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com> Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
- spring-projects#2914 (comment) - Change field key image to image[] Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
790e336 to eeff912   Compare   Signed-off-by: minsoo.nam <minsoo.nam@linecorp.com>
|   😱  |  
Related issue - #2870
Added a model to use the
Create image editAPI provided by OpenAI.https://platform.openai.com/docs/api-reference/images/createEdit