Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PI-2526 Switch to SageMaker #783

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ generic-service:
OAUTH_ENDPOINT_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk"
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.test.delius.probation.hmpps.dsd.io"
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius-dev.hmpps.service.justice.gov.uk"
BEDROCK_MODEL_ID: "p0l8bZABNIF6rA_H6bPt"
SENTRY_ENVIRONMENT: dev

allowlist:
Expand Down
1 change: 0 additions & 1 deletion helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ generic-service:
OAUTH_ENDPOINT_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk"
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.pre-prod.delius.probation.hmpps.dsd.io"
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius-preprod.hmpps.service.justice.gov.uk"
BEDROCK_MODEL_ID: "MiEGDpEB-BRJA_2PSmnQ"
SENTRY_ENVIRONMENT: preprod

allowlist:
Expand Down
1 change: 0 additions & 1 deletion helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ generic-service:
OAUTH_ENDPOINT_URL: "https://sign-in.hmpps.service.justice.gov.uk"
COMMUNITY_ENDPOINT_URL: "https://community-api-secure.probation.service.justice.gov.uk"
DELIUS_ENDPOINT_URL: "https://probation-search-and-delius.hmpps.service.justice.gov.uk"
BEDROCK_MODEL_ID: "5QoSN5EB-CIfwTDlCJYn"
SENTRY_ENVIRONMENT: prod

allowlist:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/search/contacts")
class ContactSearchController(val contactSearchService: ContactSearchService) {
@PreAuthorize("hasRole('ROLE_PROBATION_CONTACT_SEARCH')")
@PreAuthorize("hasAnyRole('ROLE_PROBATION_CONTACT_SEARCH', 'ROLE_PROBATION_INTEGRAION_ADMIN')")
@RequestMapping(method = [RequestMethod.GET, RequestMethod.POST])
fun searchContact(
@RequestBody request: ContactSearchRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.opensearch.search.fetch.subphase.highlight.HighlightBuilder
import org.opensearch.search.sort.FieldSortBuilder
import org.opensearch.search.sort.SortBuilders
import org.opensearch.search.sort.SortOrder
import org.springframework.beans.factory.annotation.Value
import org.springframework.data.domain.PageImpl
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Pageable
Expand All @@ -35,8 +34,7 @@ import org.springframework.data.elasticsearch.core.query.IndexQuery
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Service
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.LAST_UPDATED_DATETIME
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.SCORE
import uk.gov.justice.hmpps.probationsearch.contactsearch.ContactSearchService.SortType.*
import uk.gov.justice.hmpps.probationsearch.services.DeliusService
import uk.gov.justice.hmpps.sqs.audit.HmppsAuditService
import java.time.Instant
Expand All @@ -50,7 +48,6 @@ class ContactSearchService(
private val objectMapper: ObjectMapper,
private val deliusService: DeliusService,
private val openSearchClient: OpenSearchClient,
@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
) {

private val scope = CoroutineScope(Dispatchers.IO)
Expand Down Expand Up @@ -103,7 +100,6 @@ class ContactSearchService(
query.neural {
it.field("textEmbedding.knn")
.queryText(request.query)
.modelId(bedrockModelId)
.k(10)
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,4 @@ search:
mapping:
version: 1

bedrock.model.id: none

sentry.traces-sample-rate: "0.05"
Loading