Skip to content
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

feat: Initialize Spring AI Alibaba project with DotPrompt support #304

Open
wants to merge 1 commit into
base: workflow
Choose a base branch
from

Conversation

oxsean
Copy link

@oxsean oxsean commented Dec 23, 2024

Core features:

  • Implement DotPrompt template system with Handlebars support
  • Add ClassPath-based prompt loader and renderer
  • Implement LRU caching for template compilation
  • Add Spring Boot auto-configuration

Examples:

  • Add text processing example with analyze/summarize/translate capabilities
  • Include API controller for DotPrompt operations
  • Add comprehensive test cases

The project provides a Spring Boot starter for AI prompt template management, with built-in caching and flexible template loading mechanisms.

Describe what this PR does / why we need it

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

Core features:
- Implement DotPrompt template system with Handlebars support
- Add ClassPath-based prompt loader and renderer
- Implement LRU caching for template compilation
- Add Spring Boot auto-configuration

Examples:
- Add text processing example with analyze/summarize/translate capabilities
- Include API controller for DotPrompt operations
- Add comprehensive test cases

The project provides a Spring Boot starter for AI prompt template management,
with built-in caching and flexible template loading mechanisms.
@CLAassistant
Copy link

CLAassistant commented Dec 23, 2024

CLA assistant check
All committers have signed the CLA.

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或者可以不使用 lombok ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

工程里面很多地方都用了,要不用就都不用比较好

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,应该统一一下

@ConfigurationProperties(prefix = DotPromptProperties.PREFIX)
public class DotPromptProperties {

public static final String PREFIX = "spring.ai.alibaba.dotprompt";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spring.ai.dotprompt 会更好一些?这里要出现组织名字吗?cc @chickenlj

if (prompt.getInput() != null && prompt.getInput().getDefaultValues() != null) {
context.putAll(prompt.getInput().getDefaultValues());
}
if (variables != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多加一下判空?或者用 map.isEmpty()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants