Skip to content

Commit a75effe

Browse files
committed
feat: add solar api
1 parent f922195 commit a75effe

File tree

9 files changed

+709
-1
lines changed

9 files changed

+709
-1
lines changed

models/spring-ai-solar/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Solar Chat Documentation](https://console.upstage.ai/docs/capabilities/chat)
2+
3+
[Solar Embedding Documentation](https://console.upstage.ai/docs/capabilities/embeddings)

models/spring-ai-solar/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2023-2024 the original author or authors.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns="http://maven.apache.org/POM/4.0.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
20+
<modelVersion>4.0.0</modelVersion>
21+
<parent>
22+
<groupId>org.springframework.ai</groupId>
23+
<artifactId>spring-ai</artifactId>
24+
<version>1.0.0-SNAPSHOT</version>
25+
<relativePath>../../pom.xml</relativePath>
26+
</parent>
27+
<artifactId>spring-ai-solar</artifactId>
28+
<packaging>jar</packaging>
29+
<name>Spring AI Solar</name>
30+
<description>Upstage Solar support</description>
31+
<url>https://github.com/spring-projects/spring-ai</url>
32+
33+
<scm>
34+
<url>https://github.com/spring-projects/spring-ai</url>
35+
<connection>git://github.com/spring-projects/spring-ai.git</connection>
36+
<developerConnection>[email protected]:spring-projects/spring-ai.git</developerConnection>
37+
</scm>
38+
39+
<properties>
40+
</properties>
41+
42+
<dependencies>
43+
44+
<!-- production dependencies -->
45+
<dependency>
46+
<groupId>org.springframework.ai</groupId>
47+
<artifactId>spring-ai-core</artifactId>
48+
<version>${project.parent.version}</version>
49+
</dependency>
50+
51+
<dependency>
52+
<groupId>org.springframework.ai</groupId>
53+
<artifactId>spring-ai-retry</artifactId>
54+
<version>${project.parent.version}</version>
55+
</dependency>
56+
57+
<!-- Spring Framework -->
58+
<dependency>
59+
<groupId>org.springframework</groupId>
60+
<artifactId>spring-context-support</artifactId>
61+
</dependency>
62+
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-starter-logging</artifactId>
66+
</dependency>
67+
68+
<!-- test dependencies -->
69+
<dependency>
70+
<groupId>org.springframework.ai</groupId>
71+
<artifactId>spring-ai-test</artifactId>
72+
<version>${project.version}</version>
73+
<scope>test</scope>
74+
</dependency>
75+
76+
<dependency>
77+
<groupId>io.micrometer</groupId>
78+
<artifactId>micrometer-observation-test</artifactId>
79+
<scope>test</scope>
80+
</dependency>
81+
82+
</dependencies>
83+
84+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2023-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ai.solar.aot;
18+
19+
import static org.springframework.ai.aot.AiRuntimeHints.*;
20+
21+
import org.springframework.ai.solar.api.SolarApi;
22+
import org.springframework.aot.hint.MemberCategory;
23+
import org.springframework.aot.hint.RuntimeHints;
24+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
25+
import org.springframework.lang.NonNull;
26+
import org.springframework.lang.Nullable;
27+
28+
/**
29+
* The SolarRuntimeHints class is responsible for registering runtime hints for Solar API classes.
30+
*
31+
* @author Seunghyeon Ji
32+
*/
33+
public class SolarRuntimeHints implements RuntimeHintsRegistrar {
34+
35+
@Override
36+
public void registerHints(@NonNull RuntimeHints hints, @Nullable ClassLoader classLoader) {
37+
var mcs = MemberCategory.values();
38+
for (var tr : findJsonAnnotatedClassesInPackage(SolarApi.class)) {
39+
hints.reflection().registerType(tr, mcs);
40+
}
41+
for (var tr : findJsonAnnotatedClassesInPackage(SolarApi.class)) {
42+
hints.reflection().registerType(tr, mcs);
43+
}
44+
}
45+
46+
}

0 commit comments

Comments
 (0)