enumValues) {
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.enumValues = enumValues;
+ }
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/api/DefaultApi.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/api/DefaultApi.java
new file mode 100644
index 00000000..0158bbd6
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/api/DefaultApi.java
@@ -0,0 +1,119 @@
+package de.tum.in.www1.hephaestus.intelligenceservice.api;
+
+import de.tum.in.www1.hephaestus.intelligenceservice.ApiClient;
+import de.tum.in.www1.hephaestus.intelligenceservice.BaseApi;
+
+import de.tum.in.www1.hephaestus.intelligenceservice.model.ChatRequest;
+import de.tum.in.www1.hephaestus.intelligenceservice.model.ChatResponse;
+import de.tum.in.www1.hephaestus.intelligenceservice.model.HTTPValidationError;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+@Component("de.tum.in.www1.hephaestus.intelligenceservice.api.DefaultApi")
+public class DefaultApi extends BaseApi {
+
+ public DefaultApi() {
+ super(new ApiClient());
+ }
+
+ @Autowired
+ public DefaultApi(ApiClient apiClient) {
+ super(apiClient);
+ }
+
+ /**
+ * Get a response from an LLM to a chat message.
+ *
+ * 200 - Successful Response
+ *
422 - Validation Error
+ * @param chatRequest (required)
+ * @return ChatResponse
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public ChatResponse chatChatPost(ChatRequest chatRequest) throws RestClientException {
+ return chatChatPostWithHttpInfo(chatRequest).getBody();
+ }
+
+ /**
+ * Get a response from an LLM to a chat message.
+ *
+ *
200 - Successful Response
+ *
422 - Validation Error
+ * @param chatRequest (required)
+ * @return ResponseEntity<ChatResponse>
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public ResponseEntity chatChatPostWithHttpInfo(ChatRequest chatRequest) throws RestClientException {
+ Object localVarPostBody = chatRequest;
+
+ // verify the required parameter 'chatRequest' is set
+ if (chatRequest == null) {
+ throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'chatRequest' when calling chatChatPost");
+ }
+
+
+ final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
+ final HttpHeaders localVarHeaderParams = new HttpHeaders();
+ final MultiValueMap localVarCookieParams = new LinkedMultiValueMap();
+ final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ final String[] localVarContentTypes = {
+ "application/json"
+ };
+ final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+
+ String[] localVarAuthNames = new String[] { };
+
+ ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {};
+ return apiClient.invokeAPI("/chat", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
+ }
+
+ @Override
+ public ResponseEntity invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference returnType) throws RestClientException {
+ String localVarPath = url.replace(apiClient.getBasePath(), "");
+ Object localVarPostBody = request;
+
+ final Map uriVariables = new HashMap();
+ final MultiValueMap localVarQueryParams = new LinkedMultiValueMap();
+ final HttpHeaders localVarHeaderParams = new HttpHeaders();
+ final MultiValueMap localVarCookieParams = new LinkedMultiValueMap();
+ final MultiValueMap localVarFormParams = new LinkedMultiValueMap();
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ final String[] localVarContentTypes = {
+ "application/json"
+ };
+ final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+
+ String[] localVarAuthNames = new String[] { };
+
+ return apiClient.invokeAPI(localVarPath, method, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, returnType);
+ }
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/ApiKeyAuth.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/ApiKeyAuth.java
new file mode 100644
index 00000000..f6f61277
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/ApiKeyAuth.java
@@ -0,0 +1,62 @@
+package de.tum.in.www1.hephaestus.intelligenceservice.auth;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.util.MultiValueMap;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class ApiKeyAuth implements Authentication {
+ private final String location;
+ private final String paramName;
+
+ private String apiKey;
+ private String apiKeyPrefix;
+
+ public ApiKeyAuth(String location, String paramName) {
+ this.location = location;
+ this.paramName = paramName;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getParamName() {
+ return paramName;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public void setApiKey(String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ public String getApiKeyPrefix() {
+ return apiKeyPrefix;
+ }
+
+ public void setApiKeyPrefix(String apiKeyPrefix) {
+ this.apiKeyPrefix = apiKeyPrefix;
+ }
+
+ @Override
+ public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) {
+ if (apiKey == null) {
+ return;
+ }
+ String value;
+ if (apiKeyPrefix != null) {
+ value = apiKeyPrefix + " " + apiKey;
+ } else {
+ value = apiKey;
+ }
+ if (location.equals("query")) {
+ queryParams.add(paramName, value);
+ } else if (location.equals("header")) {
+ headerParams.add(paramName, value);
+ } else if (location.equals("cookie")) {
+ cookieParams.add(paramName, value);
+ }
+ }
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/Authentication.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/Authentication.java
new file mode 100644
index 00000000..0840ad65
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/Authentication.java
@@ -0,0 +1,14 @@
+package de.tum.in.www1.hephaestus.intelligenceservice.auth;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.util.MultiValueMap;
+
+public interface Authentication {
+ /**
+ * Apply authentication settings to header and / or query parameters.
+ * @param queryParams The query parameters for the request
+ * @param headerParams The header parameters for the request
+ * @param cookieParams The cookie parameters for the request
+ */
+ public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams);
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBasicAuth.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBasicAuth.java
new file mode 100644
index 00000000..f7cb4e0f
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBasicAuth.java
@@ -0,0 +1,38 @@
+package de.tum.in.www1.hephaestus.intelligenceservice.auth;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.util.MultiValueMap;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class HttpBasicAuth implements Authentication {
+ private String username;
+ private String password;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Override
+ public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) {
+ if (username == null && password == null) {
+ return;
+ }
+ String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
+ headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
+ }
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBearerAuth.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBearerAuth.java
new file mode 100644
index 00000000..6cf59a22
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/auth/HttpBearerAuth.java
@@ -0,0 +1,56 @@
+package de.tum.in.www1.hephaestus.intelligenceservice.auth;
+
+import java.util.Optional;
+import java.util.function.Supplier;
+import org.springframework.http.HttpHeaders;
+import org.springframework.util.MultiValueMap;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class HttpBearerAuth implements Authentication {
+ private final String scheme;
+ private Supplier tokenSupplier;
+
+ public HttpBearerAuth(String scheme) {
+ this.scheme = scheme;
+ }
+
+ /**
+ * Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
+ *
+ * @return The bearer token
+ */
+ public String getBearerToken() {
+ return tokenSupplier.get();
+ }
+
+ /**
+ * Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
+ *
+ * @param bearerToken The bearer token to send in the Authorization header
+ */
+ public void setBearerToken(String bearerToken) {
+ this.tokenSupplier = () -> bearerToken;
+ }
+
+ /**
+ * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
+ *
+ * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
+ */
+ public void setBearerToken(Supplier tokenSupplier) {
+ this.tokenSupplier = tokenSupplier;
+ }
+
+ @Override
+ public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) {
+ String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
+ if (bearerToken == null) {
+ return;
+ }
+ headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
+ }
+
+ private static String upperCaseBearer(String scheme) {
+ return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
+ }
+}
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatRequest.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatRequest.java
new file mode 100644
index 00000000..70234d22
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatRequest.java
@@ -0,0 +1,104 @@
+/*
+ * Hephaestus Intelligence Service API
+ * API documentation for the Hephaestus Intelligence Service.
+ *
+ * The version of the OpenAPI document: 0.0.1
+ * Contact: felixtj.dietrich@tum.de
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package de.tum.in.www1.hephaestus.intelligenceservice.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import org.hibernate.validator.constraints.*;
+
+/**
+ * ChatRequest
+ */
+@JsonPropertyOrder({
+ ChatRequest.JSON_PROPERTY_MESSAGE
+})
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class ChatRequest {
+ public static final String JSON_PROPERTY_MESSAGE = "message";
+ private String message;
+
+ public ChatRequest() {
+ }
+
+ public ChatRequest message(String message) {
+
+ this.message = message;
+ return this;
+ }
+
+ /**
+ * Get message
+ * @return message
+ */
+ @jakarta.annotation.Nonnull
+ @JsonProperty(JSON_PROPERTY_MESSAGE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+
+ public String getMessage() {
+ return message;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_MESSAGE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChatRequest chatRequest = (ChatRequest) o;
+ return Objects.equals(this.message, chatRequest.message);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(message);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ChatRequest {\n");
+ sb.append(" message: ").append(toIndentedString(message)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatResponse.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatResponse.java
new file mode 100644
index 00000000..a601104d
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ChatResponse.java
@@ -0,0 +1,104 @@
+/*
+ * Hephaestus Intelligence Service API
+ * API documentation for the Hephaestus Intelligence Service.
+ *
+ * The version of the OpenAPI document: 0.0.1
+ * Contact: felixtj.dietrich@tum.de
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package de.tum.in.www1.hephaestus.intelligenceservice.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import org.hibernate.validator.constraints.*;
+
+/**
+ * ChatResponse
+ */
+@JsonPropertyOrder({
+ ChatResponse.JSON_PROPERTY_RESPONSE
+})
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class ChatResponse {
+ public static final String JSON_PROPERTY_RESPONSE = "response";
+ private String response;
+
+ public ChatResponse() {
+ }
+
+ public ChatResponse response(String response) {
+
+ this.response = response;
+ return this;
+ }
+
+ /**
+ * Get response
+ * @return response
+ */
+ @jakarta.annotation.Nonnull
+ @JsonProperty(JSON_PROPERTY_RESPONSE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+
+ public String getResponse() {
+ return response;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_RESPONSE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public void setResponse(String response) {
+ this.response = response;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ChatResponse chatResponse = (ChatResponse) o;
+ return Objects.equals(this.response, chatResponse.response);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(response);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ChatResponse {\n");
+ sb.append(" response: ").append(toIndentedString(response)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/HTTPValidationError.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/HTTPValidationError.java
new file mode 100644
index 00000000..c66ebc68
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/HTTPValidationError.java
@@ -0,0 +1,116 @@
+/*
+ * Hephaestus Intelligence Service API
+ * API documentation for the Hephaestus Intelligence Service.
+ *
+ * The version of the OpenAPI document: 0.0.1
+ * Contact: felixtj.dietrich@tum.de
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package de.tum.in.www1.hephaestus.intelligenceservice.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import de.tum.in.www1.hephaestus.intelligenceservice.model.ValidationError;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import org.hibernate.validator.constraints.*;
+
+/**
+ * HTTPValidationError
+ */
+@JsonPropertyOrder({
+ HTTPValidationError.JSON_PROPERTY_DETAIL
+})
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class HTTPValidationError {
+ public static final String JSON_PROPERTY_DETAIL = "detail";
+ private List detail = new ArrayList<>();
+
+ public HTTPValidationError() {
+ }
+
+ public HTTPValidationError detail(List detail) {
+
+ this.detail = detail;
+ return this;
+ }
+
+ public HTTPValidationError addDetailItem(ValidationError detailItem) {
+ if (this.detail == null) {
+ this.detail = new ArrayList<>();
+ }
+ this.detail.add(detailItem);
+ return this;
+ }
+
+ /**
+ * Get detail
+ * @return detail
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_DETAIL)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+
+ public List getDetail() {
+ return detail;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_DETAIL)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public void setDetail(List detail) {
+ this.detail = detail;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HTTPValidationError htTPValidationError = (HTTPValidationError) o;
+ return Objects.equals(this.detail, htTPValidationError.detail);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(detail);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class HTTPValidationError {\n");
+ sb.append(" detail: ").append(toIndentedString(detail)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationError.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationError.java
new file mode 100644
index 00000000..458a22e0
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationError.java
@@ -0,0 +1,178 @@
+/*
+ * Hephaestus Intelligence Service API
+ * API documentation for the Hephaestus Intelligence Service.
+ *
+ * The version of the OpenAPI document: 0.0.1
+ * Contact: felixtj.dietrich@tum.de
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package de.tum.in.www1.hephaestus.intelligenceservice.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonValue;
+import de.tum.in.www1.hephaestus.intelligenceservice.model.ValidationErrorLocInner;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import org.hibernate.validator.constraints.*;
+
+/**
+ * ValidationError
+ */
+@JsonPropertyOrder({
+ ValidationError.JSON_PROPERTY_LOC,
+ ValidationError.JSON_PROPERTY_MSG,
+ ValidationError.JSON_PROPERTY_TYPE
+})
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class ValidationError {
+ public static final String JSON_PROPERTY_LOC = "loc";
+ private List loc = new ArrayList<>();
+
+ public static final String JSON_PROPERTY_MSG = "msg";
+ private String msg;
+
+ public static final String JSON_PROPERTY_TYPE = "type";
+ private String type;
+
+ public ValidationError() {
+ }
+
+ public ValidationError loc(List loc) {
+
+ this.loc = loc;
+ return this;
+ }
+
+ public ValidationError addLocItem(ValidationErrorLocInner locItem) {
+ if (this.loc == null) {
+ this.loc = new ArrayList<>();
+ }
+ this.loc.add(locItem);
+ return this;
+ }
+
+ /**
+ * Get loc
+ * @return loc
+ */
+ @jakarta.annotation.Nonnull
+ @JsonProperty(JSON_PROPERTY_LOC)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+
+ public List getLoc() {
+ return loc;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_LOC)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public void setLoc(List loc) {
+ this.loc = loc;
+ }
+
+ public ValidationError msg(String msg) {
+
+ this.msg = msg;
+ return this;
+ }
+
+ /**
+ * Get msg
+ * @return msg
+ */
+ @jakarta.annotation.Nonnull
+ @JsonProperty(JSON_PROPERTY_MSG)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+
+ public String getMsg() {
+ return msg;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_MSG)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+
+ public ValidationError type(String type) {
+
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Get type
+ * @return type
+ */
+ @jakarta.annotation.Nonnull
+ @JsonProperty(JSON_PROPERTY_TYPE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+
+ public String getType() {
+ return type;
+ }
+
+
+ @JsonProperty(JSON_PROPERTY_TYPE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ValidationError validationError = (ValidationError) o;
+ return Objects.equals(this.loc, validationError.loc) &&
+ Objects.equals(this.msg, validationError.msg) &&
+ Objects.equals(this.type, validationError.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(loc, msg, type);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ValidationError {\n");
+ sb.append(" loc: ").append(toIndentedString(loc)).append("\n");
+ sb.append(" msg: ").append(toIndentedString(msg)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationErrorLocInner.java b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationErrorLocInner.java
new file mode 100644
index 00000000..3f3658e3
--- /dev/null
+++ b/server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/model/ValidationErrorLocInner.java
@@ -0,0 +1,70 @@
+/*
+ * Hephaestus Intelligence Service API
+ * API documentation for the Hephaestus Intelligence Service.
+ *
+ * The version of the OpenAPI document: 0.0.1
+ * Contact: felixtj.dietrich@tum.de
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package de.tum.in.www1.hephaestus.intelligenceservice.model;
+
+import java.util.Objects;
+import java.util.Arrays;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import org.hibernate.validator.constraints.*;
+
+/**
+ * ValidationErrorLocInner
+ */
+@JsonPropertyOrder({
+})
+@JsonTypeName("ValidationError_loc_inner")
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
+public class ValidationErrorLocInner {
+ public ValidationErrorLocInner() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ValidationErrorLocInner {\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+}
+
diff --git a/server/intelligence-service/app/config.py b/server/intelligence-service/app/config.py
index f153b6d8..5383e680 100644
--- a/server/intelligence-service/app/config.py
+++ b/server/intelligence-service/app/config.py
@@ -1,7 +1,12 @@
-from pydantic_settings import BaseSettings
+from dotenv import load_dotenv
+from pydantic_settings import BaseSettings, SettingsConfigDict
+
+load_dotenv()
class Settings(BaseSettings):
+ model_config = SettingsConfigDict(env_file=".env")
+
OPENAI_API_KEY: str = ""
AZURE_OPENAI_API_KEY: str = ""
@@ -11,9 +16,11 @@ class Settings(BaseSettings):
@property
def is_openai_available(self):
return bool(self.OPENAI_API_KEY)
-
+
@property
def is_azure_openai_available(self):
- return bool(self.AZURE_OPENAI_API_KEY) and bool(self.AZURE_OPENAI_ENDPOINT) and bool(self.AZURE_OPENAI_API_VERSION)
+ return bool(self.AZURE_OPENAI_API_KEY) and bool(self.AZURE_OPENAI_ENDPOINT) and bool(
+ self.AZURE_OPENAI_API_VERSION)
+
settings = Settings()
diff --git a/server/intelligence-service/app/generate_openapi_yaml.py b/server/intelligence-service/app/generate_openapi_yaml.py
new file mode 100644
index 00000000..c9c2f3ce
--- /dev/null
+++ b/server/intelligence-service/app/generate_openapi_yaml.py
@@ -0,0 +1,30 @@
+from . import main
+from fastapi.openapi.utils import get_openapi
+import yaml
+
+
+def get_openapi_specs():
+ openapi_json = get_openapi(
+ title=main.app.title,
+ version=main.app.version,
+ description=main.app.description,
+ contact=main.app.contact,
+ routes=main.app.routes,
+ )
+ openapi_yaml = yaml.dump(openapi_json, allow_unicode=True)
+ return openapi_yaml
+
+
+def convert():
+ try:
+ yaml_spec = get_openapi_specs()
+ with open("server/intelligence-service/openapi.yaml", "w") as f:
+ f.write(yaml_spec)
+ print("OpenAPI YAML specification generated successfully.")
+ except Exception as e:
+ print(f"Error generating OpenAPI specs: {e}")
+ exit(1)
+
+
+if __name__ == "__main__":
+ convert()
diff --git a/server/intelligence-service/app/main.py b/server/intelligence-service/app/main.py
index 22560ae7..dd46f0f8 100644
--- a/server/intelligence-service/app/main.py
+++ b/server/intelligence-service/app/main.py
@@ -2,17 +2,27 @@
from pydantic import BaseModel
from .model import model
-app = FastAPI()
+
+app = FastAPI(
+ title="Hephaestus Intelligence Service API",
+ description="API documentation for the Hephaestus Intelligence Service.",
+ version="0.0.1",
+ contact={"name": "Felix T.J. Dietrich", "email": "felixtj.dietrich@tum.de"},
+)
class ChatRequest(BaseModel):
message: str
-@app.post("/chat", response_model=dict, summary="Chat with LLM")
+class ChatResponse(BaseModel):
+ response: str
+
+
+@app.post("/chat", response_model=ChatResponse, summary="Get a response from an LLM to a chat message.")
async def chat(request: ChatRequest):
try:
response = model.invoke(request.message)
- return { "response": response.content }
+ return {"response": response.content}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
diff --git a/server/intelligence-service/app/model.py b/server/intelligence-service/app/model.py
index e890fed0..ecacc241 100644
--- a/server/intelligence-service/app/model.py
+++ b/server/intelligence-service/app/model.py
@@ -1,11 +1,18 @@
+import os
from langchain.chat_models.base import BaseChatModel
from langchain_openai import ChatOpenAI, AzureChatOpenAI
-from .config import settings
+from .config import settings
model: BaseChatModel
-if settings.is_openai_available:
+if os.getenv("GITHUB_ACTIONS") == "true":
+ class MockChatModel():
+ def invoke(self, message: str):
+ return "Mock response"
+ model = MockChatModel()
+
+elif settings.is_openai_available:
model = ChatOpenAI()
elif settings.is_azure_openai_available:
model = AzureChatOpenAI()
diff --git a/server/intelligence-service/openapi.yaml b/server/intelligence-service/openapi.yaml
new file mode 100644
index 00000000..d33d3e8d
--- /dev/null
+++ b/server/intelligence-service/openapi.yaml
@@ -0,0 +1,82 @@
+components:
+ schemas:
+ ChatRequest:
+ properties:
+ message:
+ title: Message
+ type: string
+ required:
+ - message
+ title: ChatRequest
+ type: object
+ ChatResponse:
+ properties:
+ response:
+ title: Response
+ type: string
+ required:
+ - response
+ title: ChatResponse
+ type: object
+ HTTPValidationError:
+ properties:
+ detail:
+ items:
+ $ref: '#/components/schemas/ValidationError'
+ title: Detail
+ type: array
+ title: HTTPValidationError
+ type: object
+ ValidationError:
+ properties:
+ loc:
+ items:
+ anyOf:
+ - type: string
+ - type: integer
+ title: Location
+ type: array
+ msg:
+ title: Message
+ type: string
+ type:
+ title: Error Type
+ type: string
+ required:
+ - loc
+ - msg
+ - type
+ title: ValidationError
+ type: object
+info:
+ contact:
+ email: felixtj.dietrich@tum.de
+ name: Felix T.J. Dietrich
+ description: API documentation for the Hephaestus Intelligence Service.
+ title: Hephaestus Intelligence Service API
+ version: 0.0.1
+openapi: 3.1.0
+paths:
+ /chat:
+ post:
+ operationId: chat_chat_post
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ChatRequest'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ChatResponse'
+ description: Successful Response
+ '422':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPValidationError'
+ description: Validation Error
+ summary: Get a response from an LLM to a chat message.
diff --git a/server/intelligence-service/openapitools.json b/server/intelligence-service/openapitools.json
new file mode 100644
index 00000000..2f4612ce
--- /dev/null
+++ b/server/intelligence-service/openapitools.json
@@ -0,0 +1,7 @@
+{
+ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
+ "spaces": 2,
+ "generator-cli": {
+ "version": "7.8.0"
+ }
+}