Skip to content

Commit 56edc71

Browse files
committed
Update the docs
1 parent cf6b11e commit 56edc71

14 files changed

Lines changed: 423 additions & 183 deletions

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
Welcome to the tinystruct framework documentation. This documentation provides comprehensive guidance for using and developing with the tinystruct framework.
66

7-
欢迎查阅 tinystruct 框架文档。本文档为使用和开发 tinystruct 框架提供全面的指导。
8-
7+
欢迎查阅 tinystruct 框架文档。本文档为使用和开�tinystruct 框架提供全面的指导�
98
## What's New in v1.7.18
109

1110
- **Enhanced AI Integration**: Built-in support for AI integration and plugin-based architecture
@@ -43,11 +42,10 @@ Welcome to the tinystruct framework documentation. This documentation provides c
4342
- [数据库集成](zh/database.md)
4443
- [高级特性](zh/advanced-features.md)
4544
- [最佳实践](zh/best-practices.md)
46-
- API参考
47-
- [应用程序 API](zh/api/application.md)
45+
- API参� - [应用程序 API](zh/api/application.md)
4846
- [动作 API](zh/api/action.md)
4947
- [配置 API](zh/api/configuration.md)
50-
- [数据库 API](zh/api/database.md)
48+
- [数据�API](zh/api/database.md)
5149

5250
## Quick Start
5351

@@ -68,7 +66,7 @@ Add the dependency to your `pom.xml`:
6866
<dependency>
6967
<groupId>org.tinystruct</groupId>
7068
<artifactId>tinystruct</artifactId>
71-
<version>1.7.19</version>
69+
<version>1.7.25</version>
7270
<classifier>jar-with-dependencies</classifier>
7371
</dependency>
7472
```
@@ -161,7 +159,6 @@ If you'd like to contribute to this documentation, please:
161159
2. Create a new branch for your changes / 创建新的分支
162160
3. Submit a pull request with your improvements / 提交拉取请求
163161

164-
## License / 许可证
165-
162+
## License / 许可�
166163
This documentation is licensed under the same terms as the tinystruct framework (Apache License 2.0).
167-
本文档采用与 tinystruct 框架相同的许可条款。
164+
本文档采用与 tinystruct 框架相同的许可条款�

en/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Add the dependency to your pom.xml:
2828
<dependency>
2929
<groupId>org.tinystruct</groupId>
3030
<artifactId>tinystruct</artifactId>
31-
<version>1.7.23</version>
31+
<version>1.7.25</version>
3232
<classifier>jar-with-dependencies</classifier>
3333
</dependency>
3434
```
@@ -97,4 +97,4 @@ public class Example extends AbstractApplication {
9797

9898
## License
9999

100-
Licensed under the Apache License, Version 2.0
100+
Licensed under the Apache License, Version 2.0

en/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
* [Database Integration](database.md)
1010
* [Advanced Features](advanced-features.md)
1111
* [Best Practices](best-practices.md)
12+
* [What's New in 1.7.25](whats-new-1.7.25.md)
1213
* [What's New in 1.7.23](whats-new-1.7.23.md)
1314

1415
## API Reference
1516
* [Action API](api/action.md)
1617
* [Application API](api/application.md)
1718
* [Configuration API](api/configuration.md)
18-
* [Database API](api/database.md)
19+
* [Database API](api/database.md)

en/core-concepts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Actions are the core building blocks of tinystruct applications. They handle bot
5252
)
5353
```
5454

55-
### HTTP Method-Specific Actions (New in 1.7.17)
55+
### HTTP Method-Specific Actions (New in 1.7.25)
5656

5757
You can now specify which HTTP methods an action responds to:
5858

@@ -271,7 +271,7 @@ dispatcher.dispatch(new UserCreatedEvent(newUser));
271271

272272
## AI Integration
273273

274-
New in version 1.7.17, tinystruct includes built-in support for AI integration:
274+
New in version 1.7.25, tinystruct includes built-in support for AI integration:
275275

276276
### MCP (Model Context Protocol) Support
277277

en/database.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,75 @@ found.update();
736736
found.delete();
737737
```
738738

739+
## Vector Database Operations (New in 1.7.25)
740+
741+
Tinystruct 1.7.25 introduces native support for vector databases, designed for AI applications that require similarity searches based on vector embeddings.
742+
743+
### Configuration
744+
745+
To enable vector database support, configure the following properties in your `config.properties`:
746+
747+
```properties
748+
# Vector Database Configuration
749+
vector.database.driver=org.sqlite.JDBC
750+
vector.database.url=jdbc:sqlite:src/main/resources/vector.db
751+
```
752+
753+
### VectorOperator
754+
755+
The `VectorOperator` class is a specialized operator for managing vector data. It extends `DatabaseOperator` and provides methods for adding, deleting, and searching vectors.
756+
757+
#### Adding Vectors
758+
759+
```java
760+
double[] vector = {0.1, 0.2, 0.3, ...}; // Your embedding vector
761+
String label = "Document Title";
762+
int entityId = 101;
763+
String entityType = "Article";
764+
765+
try (VectorOperator operator = new VectorOperator()) {
766+
operator.add(vector, label, entityId, entityType);
767+
} catch (ApplicationException e) {
768+
// Handle exception
769+
}
770+
```
771+
772+
#### Similarity Search
773+
774+
You can search for the most similar vectors using cosine similarity:
775+
776+
```java
777+
double[] queryVector = {...};
778+
int topK = 5; // Number of results to return
779+
780+
try (VectorOperator operator = new VectorOperator()) {
781+
List<SearchResult> results = operator.search(queryVector, topK);
782+
783+
for (SearchResult result : results) {
784+
System.out.println("Entity ID: " + result.getEntityId());
785+
System.out.println("Score: " + result.getScore()); // Cosine similarity score
786+
}
787+
} catch (ApplicationException e) {
788+
// Handle exception
789+
}
790+
```
791+
792+
### Vector Interface
793+
794+
For a higher-level abstraction, you can use the `Vector` interface:
795+
796+
```java
797+
import org.tinystruct.data.Vector;
798+
799+
// Similarity search based on a query string (requires implementation of embedding generation)
800+
List<Data> similarItems = vector.similarity("search query");
801+
```
802+
803+
### Supported Engines
804+
805+
The current implementation of `VectorOperator` uses **SQLite** as its default storage engine, making it lightweight and easy to deploy without a separate database server.
806+
807+
739808
## Best Practices
740809

741810
1. **Connection Management**: Always close your database connections when done.

en/getting-started.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Add the tinystruct dependency to your project's `pom.xml` file:
2929
<dependency>
3030
<groupId>org.tinystruct</groupId>
3131
<artifactId>tinystruct</artifactId>
32-
<version>1.7.23</version>
32+
<version>1.7.25</version>
3333
<classifier>jar-with-dependencies</classifier>
3434
</dependency>
3535
```
@@ -74,7 +74,7 @@ public class HelloWorldApp extends AbstractApplication {
7474
return "Hello, " + name + "!";
7575
}
7676

77-
// HTTP method-specific actions (new in 1.7.17)
77+
// HTTP method-specific actions (new in 1.7.25)
7878
@Action(value = "greet", mode = Mode.HTTP_GET)
7979
public String greetGet() {
8080
return "GET: Hello!";
@@ -185,7 +185,7 @@ The framework automatically:
185185

186186
### HTTP Method-Specific Actions
187187

188-
New in version 1.7.17, you can specify which HTTP methods an action responds to:
188+
New in version 1.7.25, you can specify which HTTP methods an action responds to:
189189

190190
```java
191191
@Action(value = "resource", mode = Mode.HTTP_GET)
@@ -208,25 +208,25 @@ A typical tinystruct project structure looks like this:
208208
```
209209
my-app/
210210
├── src/
211-
│ ├── main/
212-
│ │ ├── java/
213-
│ │ │ └── com/
214-
│ │ │ └── example/
215-
│ │ │ ├── HelloWorldApp.java
216-
│ │ │ ├── actions/
217-
│ │ │ ├── models/
218-
│ │ │ ├── services/
219-
│ │ │ └── repositories/
220-
│ │ └── resources/
221-
│ │ ├── config.properties
222-
│ │ └── templates/
223-
│ └── test/
224-
└── java/
225-
└── com/
226-
└── example/
227-
└── HelloWorldAppTest.java
211+
� ├── main/
212+
� � ├── java/
213+
� � � └── com/
214+
� � � └── example/
215+
� � � ├── HelloWorldApp.java
216+
� � � ├── actions/
217+
� � � ├── models/
218+
� � � ├── services/
219+
� � � └── repositories/
220+
� � └── resources/
221+
� � ├── config.properties
222+
� � └── templates/
223+
� └── test/
224+
� └── java/
225+
� └── com/
226+
� └── example/
227+
� └── HelloWorldAppTest.java
228228
├── bin/
229-
│ └── dispatcher
229+
� └── dispatcher
230230
└── pom.xml
231231
```
232232

en/whats-new-1.7.25.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# What's New in tinystruct 1.7.25
2+
3+
This document highlights the new features, improvements, and changes introduced in tinystruct version 1.7.25.
4+
5+
> See also: [What's New in 1.7.23](whats-new-1.7.23.md) for earlier features including the built-in POJO generator and native LocalDateTime support.
6+
7+
## Major New Features
8+
9+
### 1. Vector Database Support
10+
11+
Version 1.7.25 introduces comprehensive support for vector operations, enabling next-gen AI applications that require similarity searches and embedding storage.
12+
13+
**Key Components:**
14+
- **`org.tinystruct.data.Vector`**: A new interface for managing vector collections.
15+
- **`org.tinystruct.data.VectorOperator`**: A specialized operator for executing vector-based queries, supporting SQLite as the default storage engine.
16+
- **Similarity Search**: Built-in support for cosine similarity searches to find related data based on embedding vectors.
17+
18+
**Example Usage:**
19+
20+
```java
21+
// Adding a vector to the database
22+
double[] embedding = getEmbedding("Some text content");
23+
try (VectorOperator operator = new VectorOperator()) {
24+
operator.add(embedding, "label", 123, "entityType");
25+
}
26+
27+
// Searching for similar vectors
28+
try (VectorOperator operator = new VectorOperator()) {
29+
List<SearchResult> results = operator.search(queryVector, 5);
30+
for (SearchResult result : results) {
31+
System.out.println("Similar entity ID: " + result.getEntityId());
32+
}
33+
}
34+
```
35+
36+
### 2. Performance & Stability Improvements
37+
38+
- **`SSEPushManager` Fixes**: Enhanced reliability for Server-Sent Events with better connection management and test coverage.
39+
- **NullPointerException Handling**: Fixed various edge cases where NPEs could occur during complex request handling.
40+
- **Optimized Thread Management**: Replaced active-wait loops with more efficient thread blocking mechanisms, reducing CPU usage during idle periods.
41+
- **Enhanced Application Management**: Improved stability in the `ApplicationManager` for starting and stopping services.
42+
43+
## Configuration
44+
45+
To use the vector database, you can configure the following properties:
46+
47+
```properties
48+
# config.properties
49+
vector.database.driver=org.sqlite.JDBC
50+
vector.database.url=jdbc:sqlite:src/main/resources/vector.db
51+
```
52+
53+
## Migration Guide
54+
55+
### From 1.7.23 to 1.7.25
56+
57+
1. **Update Maven Dependency**
58+
```xml
59+
<dependency>
60+
<groupId>org.tinystruct</groupId>
61+
<artifactId>tinystruct</artifactId>
62+
<version>1.7.25</version>
63+
</dependency>
64+
```
65+
66+
2. **Initialize Vector Database** (Optional)
67+
If you plan to use vector features, ensure the `vector.db` file is present in your resources or configured correctly in your properties.
68+
69+
## Community and Resources
70+
71+
- **GitHub**: <https://github.com/tinystruct/tinystruct>
72+
- **Documentation**: <https://tinystruct.org>
73+
- **Examples**: <https://github.com/tinystruct/tinystruct-examples>
74+
75+
## Conclusion
76+
77+
Version 1.7.25 focuses on bringing AI-native capabilities to the tinystruct framework through its new vector support, while continuing to improve the core performance and stability that developers expect.

0 commit comments

Comments
 (0)