Skip to content

Commit 7769463

Browse files
authored
PI-2526 Switch to SageMaker (#783)
1 parent b54f446 commit 7769463

File tree

6 files changed

+2
-11
lines changed

6 files changed

+2
-11
lines changed

helm_deploy/values-dev.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ generic-service:
1212
OAUTH_ENDPOINT_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk"
1313
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.test.delius.probation.hmpps.dsd.io"
1414
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius-dev.hmpps.service.justice.gov.uk"
15-
BEDROCK_MODEL_ID: "p0l8bZABNIF6rA_H6bPt"
1615
SENTRY_ENVIRONMENT: dev
1716

1817
allowlist:

helm_deploy/values-preprod.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ generic-service:
1010
OAUTH_ENDPOINT_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk"
1111
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.pre-prod.delius.probation.hmpps.dsd.io"
1212
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius-preprod.hmpps.service.justice.gov.uk"
13-
BEDROCK_MODEL_ID: "MiEGDpEB-BRJA_2PSmnQ"
1413
SENTRY_ENVIRONMENT: preprod
1514

1615
allowlist:

helm_deploy/values-prod.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ generic-service:
1111
OAUTH_ENDPOINT_URL: "https://sign-in.hmpps.service.justice.gov.uk"
1212
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.probation.service.justice.gov.uk"
1313
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius.hmpps.service.justice.gov.uk"
14-
BEDROCK_MODEL_ID: "5QoSN5EB-CIfwTDlCJYn"
1514
SENTRY_ENVIRONMENT: prod
1615

1716
allowlist:

src/main/kotlin/uk/gov/justice/hmpps/probationsearch/contactsearch/ContactSearchController.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*
99
@RestController
1010
@RequestMapping("/search/contacts")
1111
class ContactSearchController(val contactSearchService: ContactSearchService) {
12-
@PreAuthorize("hasRole('ROLE_PROBATION_CONTACT_SEARCH')")
12+
@PreAuthorize("hasAnyRole('ROLE_PROBATION_CONTACT_SEARCH', 'ROLE_PROBATION_INTEGRAION_ADMIN')")
1313
@RequestMapping(method = [RequestMethod.GET, RequestMethod.POST])
1414
fun searchContact(
1515
@RequestBody request: ContactSearchRequest,

src/main/kotlin/uk/gov/justice/hmpps/probationsearch/contactsearch/ContactSearchService.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.opensearch.search.fetch.subphase.highlight.HighlightBuilder
2424
import org.opensearch.search.sort.FieldSortBuilder
2525
import org.opensearch.search.sort.SortBuilders
2626
import org.opensearch.search.sort.SortOrder
27-
import org.springframework.beans.factory.annotation.Value
2827
import org.springframework.data.domain.PageImpl
2928
import org.springframework.data.domain.PageRequest
3029
import org.springframework.data.domain.Pageable
@@ -35,8 +34,7 @@ import org.springframework.data.elasticsearch.core.query.IndexQuery
3534
import org.springframework.security.core.context.SecurityContextHolder
3635
import org.springframework.stereotype.Service
3736
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType
38-
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.LAST_UPDATED_DATETIME
39-
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.SCORE
37+
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.*
4038
import uk.gov.justice.hmpps.probationsearch.services.DeliusService
4139
import uk.gov.justice.hmpps.sqs.audit.HmppsAuditService
4240
import java.time.Instant
@@ -50,7 +48,6 @@ class ContactSearchService(
5048
private val objectMapper: ObjectMapper,
5149
private val deliusService: DeliusService,
5250
private val openSearchClient: OpenSearchClient,
53-
@Value("\${bedrock.model.id}") private val bedrockModelId: String, // Temp, remove after upgrading to OpenSearch 2.16 - workaround for https://github.com/opensearch-project/OpenSearch/issues/15034
5451
) {
5552

5653
private val scope = CoroutineScope(Dispatchers.IO)
@@ -103,7 +100,6 @@ class ContactSearchService(
103100
query.neural {
104101
it.field("textEmbedding.knn")
105102
.queryText(request.query)
106-
.modelId(bedrockModelId)
107103
.k(10)
108104
}
109105
}

src/main/resources/application.yml

-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,4 @@ search:
7272
mapping:
7373
version: 1
7474

75-
bedrock.model.id: none
76-
7775
sentry.traces-sample-rate: "0.05"

0 commit comments

Comments
 (0)