Skip to content

Commit

Permalink
refactor(JAQPOT-467): rename model type to OPENAI_LLM (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv authored Jan 8, 2025
1 parent db9ae59 commit b155d31
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 15 deletions.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ dependencies {
implementation("software.amazon.awssdk:s3")
implementation("software.amazon.awssdk:sts")

// openai client
implementation("com.openai:openai-java:0.10.0")

// tests
// rest assured
testImplementation("io.rest-assured:rest-assured:5.4.0")
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/org/jaqpot/api/entity/ModelType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package org.jaqpot.api.entity
enum class ModelType {
// DOCKER models
DOCKER,
DOCKER_LLM,

// LLM
OPENAI_LLM,

SKLEARN_ONNX,

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/jaqpot/api/mapper/ModelTypeMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun ModelTypeDto.toEntity(): ModelType {
ModelTypeDto.QSAR_TOOLBOX_QSAR_MODEL -> ModelType.QSAR_TOOLBOX_QSAR_MODEL
ModelTypeDto.QSAR_TOOLBOX_PROFILER -> ModelType.QSAR_TOOLBOX_PROFILER
ModelTypeDto.DOCKER -> ModelType.DOCKER
ModelTypeDto.DOCKER_LLM -> ModelType.DOCKER_LLM
ModelTypeDto.OPENAI_LLM -> ModelType.OPENAI_LLM
}
}

Expand All @@ -47,6 +47,6 @@ fun ModelType.toDto(): ModelTypeDto {
ModelType.QSAR_TOOLBOX_QSAR_MODEL -> ModelTypeDto.QSAR_TOOLBOX_QSAR_MODEL
ModelType.QSAR_TOOLBOX_PROFILER -> ModelTypeDto.QSAR_TOOLBOX_PROFILER
ModelType.DOCKER -> ModelTypeDto.DOCKER
ModelType.DOCKER_LLM -> ModelTypeDto.DOCKER_LLM
ModelType.OPENAI_LLM -> ModelTypeDto.OPENAI_LLM
}
}
6 changes: 3 additions & 3 deletions src/main/kotlin/org/jaqpot/api/service/model/ModelService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.jaqpot.api.service.dataset.csv.CSVDataConverter
import org.jaqpot.api.service.dataset.csv.CSVParser
import org.jaqpot.api.service.model.config.ModelConfiguration
import org.jaqpot.api.service.model.dto.StreamPredictRequestDto
import org.jaqpot.api.service.prediction.PredictionService
import org.jaqpot.api.service.prediction.rest.RESTPredictionService
import org.jaqpot.api.service.prediction.streaming.StreamingPredictionService
import org.jaqpot.api.service.ratelimit.WithRateLimitProtectionByUser
import org.jaqpot.api.service.util.SortUtil.Companion.parseSortParameters
Expand Down Expand Up @@ -50,7 +50,7 @@ class ModelService(
private val authenticationFacade: AuthenticationFacade,
private val modelRepository: ModelRepository,
private val userService: UserService,
private val predictionService: PredictionService,
private val RESTPredictionService: RESTPredictionService,
private val datasetRepository: DatasetRepository,
private val organizationRepository: OrganizationRepository,
private val csvParser: CSVParser,
Expand Down Expand Up @@ -325,7 +325,7 @@ class ModelService(
it.toPredictionDto(doaData)
}

this.predictionService.executePredictionAndSaveResults(
this.RESTPredictionService.executePredictionAndSaveResults(
model.toPredictionModelDto(rawModel, doaDtos, rawPreprocessor),
dataset
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jaqpot.api.service.prediction
package org.jaqpot.api.service.prediction.rest

import io.github.oshai.kotlinlogging.KotlinLogging
import org.jaqpot.api.entity.Dataset
Expand All @@ -16,7 +16,7 @@ import org.springframework.stereotype.Service


@Service
class PredictionService(
class RESTPredictionService(
private val datasetRepository: DatasetRepository,
private val predictionChain: PredictionChain,
private val storageService: StorageService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import org.jaqpot.api.model.ModelTypeDto
import org.jaqpot.api.model.PredictionModelDto
import org.jaqpot.api.model.PredictionResponseDto
import org.jaqpot.api.service.model.QSARToolboxPredictionService
import org.jaqpot.api.service.prediction.runtime.runtimes.JaqpotDockerModelRuntime
import org.jaqpot.api.service.prediction.runtime.runtimes.JaqpotPyV6Runtime
import org.jaqpot.api.service.prediction.runtime.runtimes.JaqpotRV6Runtime
import org.jaqpot.api.service.prediction.runtime.runtimes.RuntimeBase
import org.jaqpot.api.service.prediction.runtime.runtimes.legacy.*
import org.jaqpot.api.service.prediction.runtime.runtimes.rest.JaqpotDockerModelRuntime
import org.jaqpot.api.service.prediction.runtime.runtimes.rest.JaqpotPyV6Runtime
import org.jaqpot.api.service.prediction.runtime.runtimes.rest.JaqpotRV6Runtime
import org.springframework.stereotype.Component


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.jaqpot.api.service.prediction.runtime.runtimes
package org.jaqpot.api.service.prediction.runtime.runtimes.rest

import org.jaqpot.api.model.DatasetDto
import org.jaqpot.api.model.PredictionModelDto
import org.jaqpot.api.model.PredictionRequestDto
import org.jaqpot.api.repository.DockerConfigRepository
import org.jaqpot.api.service.prediction.runtime.config.RuntimeConfiguration
import org.jaqpot.api.service.prediction.runtime.runtimes.RuntimeBase
import org.jaqpot.api.service.prediction.runtime.runtimes.util.DockerRuntimeUtil.Companion.retrieveDockerModelInferenceUrl
import org.jaqpot.api.service.prediction.runtime.runtimes.util.HttpClientUtil
import org.springframework.stereotype.Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.jaqpot.api.service.prediction.runtime.runtimes
package org.jaqpot.api.service.prediction.runtime.runtimes.rest

import org.jaqpot.api.model.DatasetDto
import org.jaqpot.api.model.PredictionModelDto
import org.jaqpot.api.model.PredictionRequestDto
import org.jaqpot.api.service.prediction.runtime.config.RuntimeConfiguration
import org.jaqpot.api.service.prediction.runtime.runtimes.RuntimeBase
import org.springframework.stereotype.Component

@Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.jaqpot.api.service.prediction.runtime.runtimes
package org.jaqpot.api.service.prediction.runtime.runtimes.rest

import org.jaqpot.api.model.DatasetDto
import org.jaqpot.api.model.ModelTypeDto
import org.jaqpot.api.model.PredictionModelDto
import org.jaqpot.api.model.PredictionRequestDto
import org.jaqpot.api.service.prediction.runtime.config.RuntimeConfiguration
import org.jaqpot.api.service.prediction.runtime.runtimes.RuntimeBase
import org.jaqpot.api.service.prediction.runtime.runtimes.util.HttpClientUtil
import org.springframework.stereotype.Component
import reactor.netty.http.client.HttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE model
SET type = 'OPENAI_LLM'
WHERE type = 'DOCKER_LLM';
2 changes: 1 addition & 1 deletion src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ components:
- R_TREE_CLASS
- R_TREE_REGR
- DOCKER
- DOCKER_LLM
- OPENAI_LLM
- QSAR_TOOLBOX_CALCULATOR
- QSAR_TOOLBOX_QSAR_MODEL
- QSAR_TOOLBOX_PROFILER
Expand Down

0 comments on commit b155d31

Please sign in to comment.