Commit Graph

61 Commits

Author SHA1 Message Date
Soby Chacko
d9e7ace996 Miscellaneous checkstyle fixes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-14 09:48:03 +01:00
Mark Pollack
eebf2f01b7 fix extraneous test 2025-04-10 12:24:41 -04:00
Soby Chacko
186175a96d Refactor RuntimeHints to scan entire packages for JsonInclude annotations (#2681)
- Replace class-by-class scanning with comprehensive package-level scanning to capture
  all JSON-annotated classes within each model's package hierarchy.
- Update tests to verify registered types and add specific type assertions.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-09 19:22:35 -04:00
Alexandre Roman
2e6d6ea438 feat(multimudality): Add support for base64-encoded images in tool call results (#2368)
- Enhance McpToolUtils to handle base64-encoded images in JSON responses
- Add Base64Wrapper record to parse JSON structures containing base64 image data
- Implement image conversion in DefaultToolCallResultConverter to encode RenderedImage as base64 PNG
- Add tests for DefaultToolCallResultConverter including image conversion
- Gracefully handle unsupported JSON structure for base64 wrappers

Signed-off-by: Alexandre Roman <alexandre.roman@broadcom.com>
2025-04-09 21:25:17 +02:00
Ricken Bazolo
3fcb10a326 feat(mistral-ai): Add moderation model support (#2201)
Implement MistralAI moderation capabilities to detect potentially harmful content.
This allows Spring AI applications to use Mistral's content moderation services
to identify and filter inappropriate content before processing

- Add MistralAiModerationApi for interacting with Mistral's moderation endpoints
- Create MistralAiModerationModel implementing the ModerationModel interface
- Add configuration properties and auto-configuration for the moderation model
- Extend Categories and CategoryScores with additional moderation categories
- Add integration tests to verify moderation functionality

Signed-off-by: Ricken Bazolo <ricken.bazolo@gmail.com>
2025-04-09 19:51:34 +02:00
Josh Long
fbec267eca first cut of aot improvements
Signed-off-by: Josh Long <54473+joshlong@users.noreply.github.com>
2025-04-08 19:25:39 +01:00
Christian Tzolov
0d748e2b87 feat(tool): Add ToolExecutionEligibilityChecker interface
Introduce a new ToolExecutionEligibilityChecker interface to provide a more flexible way to determine
when tool execution should be performed based on model responses. This abstraction replaces the
hardcoded logic previously scattered across the codebase.

- Adds a new ToolExecutionEligibilityChecker interface in spring-ai-core
- Integrates the checker into OpenAiChatModel with appropriate defaults
- Updates OpenAiChatAutoConfiguration to support the new interface
- Provides a default implementation that maintains backward compatibility

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>

refactor: Replace ToolExecutionEligibilityChecker with ToolExecutionEligibilityPredicate

- Replacing ToolExecutionEligibilityChecker with ToolExecutionEligibilityPredicate
- Changing from Function<ChatResponse, Boolean> to BiPredicate<ChatOptions, ChatResponse>
- Adding a DefaultToolExecutionEligibilityPredicate implementation
- Updating AnthropicChatModel and OpenAiChatModel to use the new predicate
- Updating auto-configurations to inject the new predicate
- Adding comprehensive tests for the new predicate implementation

The new approach provides a cleaner and more consistent way to determine when tool execution should be performed based on both prompt options and chat responses.

Add Bedrock Converse support

add mistral support

Add ollama and vertex gemini

add ToolExecutionEligibilityPredicate docs

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-04-08 15:22:53 +01:00
Soby Chacko
5f1e3ab135 Move AOT runtime hints package and classes from spring-ai-client-chat to spring-ai-model
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-04 12:43:22 -04:00
Mark Pollack
d45ff8e984 Refactorings
- Avoid overlapping package names
  Changed in spring-ai-commons package from org.sf.ai.model to org.sf.ai.content
  Refactor advisor module name to be spring-ai-advisors-vector-store
    Moved advisors into org.springframework.ai.chat.client.advisor.vectorstore

- Created top level memory directory
- Create new module spring-ai-model-chat-memory-neo4j and moved neo4j memory classes out of the vectorstore module
  Updated neo4j autoconfiguation
2025-04-04 11:44:38 -04:00
Ilayaperumal Gopinathan
20e2be5578 Restructure Spring AI model module
- Pull chat, image, moderation, tool, audio specific api code into spring-ai-model module
  - Move the corresponding tests

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-04 11:44:38 -04:00
Mark Pollack
69d5b5fcf0 Extract core modules for improved architecture
Extract functionality from spring-ai-core into dedicated modules:
  - spring-ai-commons: Common utilities and document handling
  - spring-ai-model: Core model interfaces and implementations
  - spring-ai-vector-store: Vector store abstraction and implementation

  This modularization creates clearer responsibility boundaries and allows
  consumers to include only what they need. The restructuring will make the
  codebase easier to maintain and extend as the project grows.
2025-04-04 11:44:38 -04:00