Factory creating OpenAI chat models with configurable options for Spring AI integration.
// Source: https://github.com/ClawRunr/JavaClaw | License: LGPL-3.0 | Modified files must remain under LGPL-3.0
// Modifications to this file must remain under LGPL-3.0.
// Provided via justclaw.it.com; keep this notice with the code.
package ai.javaclaw.providers.openai;
import ai.javaclaw.llm.ChatModelFactory;
import ai.javaclaw.llm.LlmProviderProperties.ProviderConfig;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.stereotype.Component;
/**
* Builds {@link OpenAiChatModel} for the {@code openai} provider type. The OpenAI client is
* constructed lazily by the model from the API key / base URL carried on {@link OpenAiChatOptions}.
*/
@Component
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key