11 changed files with 200 additions and 30 deletions
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2025 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.data.ai; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonSubTypes; |
||||
|
import com.fasterxml.jackson.annotation.JsonTypeInfo; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@JsonTypeInfo( |
||||
|
use = JsonTypeInfo.Id.NAME, |
||||
|
include = JsonTypeInfo.As.EXISTING_PROPERTY, |
||||
|
property = "provider", |
||||
|
visible = true |
||||
|
) |
||||
|
@JsonSubTypes({ |
||||
|
@JsonSubTypes.Type(value = OpenAiConfig.class, name = "OPENAI"), |
||||
|
@JsonSubTypes.Type(value = GoogleAiGeminiConfig.class, name = "GOOGLE_AI_GEMINI"), |
||||
|
@JsonSubTypes.Type(value = MistralAiConfig.class, name = "MISTRAL_AI") |
||||
|
}) |
||||
|
public abstract class AiConfig { |
||||
|
|
||||
|
@Schema( |
||||
|
requiredMode = Schema.RequiredMode.REQUIRED, |
||||
|
accessMode = Schema.AccessMode.READ_WRITE, |
||||
|
description = "API key for authenticating with the AI provider", |
||||
|
example = "sk-********************************" |
||||
|
) |
||||
|
private String apiKey; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2025 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.data.ai; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@Schema( |
||||
|
name = "GoogleAiGemini", |
||||
|
description = "Configuration properties for the Google AI Gemini" |
||||
|
) |
||||
|
public class GoogleAiGeminiConfig extends AiConfig { |
||||
|
|
||||
|
@Schema( |
||||
|
requiredMode = Schema.RequiredMode.REQUIRED, |
||||
|
accessMode = Schema.AccessMode.READ_WRITE, |
||||
|
description = "Name of the AI provider", |
||||
|
example = "GOOGLE_AI_GEMINI", |
||||
|
allowableValues = "GOOGLE_AI_GEMINI", |
||||
|
type = "string" |
||||
|
) |
||||
|
private AiProvider provider = AiProvider.GOOGLE_AI_GEMINI; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2025 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.data.ai; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@Schema( |
||||
|
name = "MistralAi", |
||||
|
description = "Configuration properties for the Mistral AI" |
||||
|
) |
||||
|
public class MistralAiConfig extends AiConfig { |
||||
|
|
||||
|
@Schema( |
||||
|
requiredMode = Schema.RequiredMode.REQUIRED, |
||||
|
accessMode = Schema.AccessMode.READ_WRITE, |
||||
|
description = "Name of the AI provider", |
||||
|
example = "MISTRAL_AI", |
||||
|
allowableValues = "MISTRAL_AI", |
||||
|
type = "string" |
||||
|
) |
||||
|
private AiProvider provider = AiProvider.MISTRAL_AI; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2025 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.data.ai; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@Schema( |
||||
|
name = "OpenAiConfig", |
||||
|
description = "Configuration properties for the OpenAI" |
||||
|
) |
||||
|
public class OpenAiConfig extends AiConfig { |
||||
|
|
||||
|
@Schema( |
||||
|
requiredMode = Schema.RequiredMode.REQUIRED, |
||||
|
accessMode = Schema.AccessMode.READ_WRITE, |
||||
|
description = "Name of the AI provider", |
||||
|
example = "OPENAI", |
||||
|
allowableValues = "OPENAI", |
||||
|
type = "string" |
||||
|
) |
||||
|
private AiProvider provider = AiProvider.OPENAI; |
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue