Skip to content

Commit 1a20b5f

Browse files
authored
Merge pull request #1006 from alphagov/472-remove-remaining-openai-integration
[CHAT-472] Remove remaining OpenAI integration
2 parents f9ed8d2 + 7aaefb4 commit 1a20b5f

21 files changed

Lines changed: 22 additions & 609 deletions

.env.example

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
## variables for working with OpenAI
2-
OPENAI_ACCESS_TOKEN=
3-
41
## Opensearch configuration. Not required for local development using govuk-docker
52
OPENSEARCH_URL=
63
OPENSEARCH_USERNAME=
74
OPENSEARCH_PASSWORD=
85

9-
## Optional variables to use models hosted on Amazon Bedrock instead of OpenAI
10-
# ANSWER_STRATEGY=claude_answer_strategy
11-
# EMBEDDING_PROVIDER=titan
6+
## Optional variables to use alternate answer strategy
7+
# ANSWER_STRATEGY=non_llm_answer
128

139
## Optional variables to configure AWS Bedrock interactions
1410
# BEDROCK_CLAUDE_JAILBREAK_GUARDRAILS_MODEL=

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ gem "opensearch-ruby"
3838
gem "pg"
3939
gem "prometheus_exporter"
4040
gem "rack-attack"
41-
gem "ruby-openai"
4241
gem "sentry-sidekiq"
4342
gem "slack-poster"
4443
gem "sprockets-rails"

Gemfile.lock

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ GEM
184184
ethon (0.18.0)
185185
ffi (>= 1.15.0)
186186
logger
187-
event_stream_parser (1.0.0)
188187
execjs (2.10.0)
189188
factory_bot (6.5.5)
190189
activesupport (>= 6.1.0)
@@ -197,8 +196,6 @@ GEM
197196
logger
198197
faraday-follow_redirects (0.5.0)
199198
faraday (>= 1, < 3)
200-
faraday-multipart (1.1.1)
201-
multipart-post (~> 2.0)
202199
faraday-net_http (3.4.2)
203200
net-http (~> 0.5)
204201
faraday-typhoeus (2.0.0)
@@ -400,7 +397,6 @@ GEM
400397
multi_json (1.19.1)
401398
multi_xml (0.8.1)
402399
bigdecimal (>= 3.1, < 5)
403-
multipart-post (2.4.1)
404400
net-http (0.9.1)
405401
uri (>= 0.11.1)
406402
net-imap (0.6.3)
@@ -791,10 +787,6 @@ GEM
791787
rubocop-rspec (3.9.0)
792788
lint_roller (~> 1.1)
793789
rubocop (~> 1.81)
794-
ruby-openai (8.3.0)
795-
event_stream_parser (>= 0.3.0, < 2.0.0)
796-
faraday (>= 1)
797-
faraday-multipart (>= 1)
798790
ruby-progressbar (1.13.0)
799791
rubyzip (2.4.1)
800792
sass-embedded (1.81.0-aarch64-linux-gnu)
@@ -956,7 +948,6 @@ DEPENDENCIES
956948
rails (= 8.1.3)
957949
rspec-rails
958950
rubocop-govuk
959-
ruby-openai
960951
sentry-sidekiq
961952
simplecov
962953
slack-poster
@@ -1027,13 +1018,11 @@ CHECKSUMS
10271018
erb_lint (0.9.0) sha256=dfb5e40ad839e8d1f0d56ca85ec9a7ac4c9cd966ec281138282f35b323ca7c31
10281019
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
10291020
ethon (0.18.0) sha256=b598afc9f30448cb068b850714b7d6948e941476095d04f90a4ac65b8d6efcb2
1030-
event_stream_parser (1.0.0) sha256=a2683bab70126286f8184dc88f7968ffc4028f813161fb073ec90d171f7de3c8
10311021
execjs (2.10.0) sha256=6bcb8be8f0052ff9d370b65d1c080f2406656e150452a0abdb185a133048450d
10321022
factory_bot (6.5.5) sha256=ce59295daee1b4704dab8a2fee6816f513d467c6aa3bc587860767d74a66efbe
10331023
factory_bot_rails (6.5.1) sha256=d3cc4851eae4dea8a665ec4a4516895045e710554d2b5ac9e68b94d351bc6d68
10341024
faraday (2.14.1) sha256=a43cceedc1e39d188f4d2cdd360a8aaa6a11da0c407052e426ba8d3fb42ef61c
10351025
faraday-follow_redirects (0.5.0) sha256=5cde93c894b30943a5d2b93c2fe9284216a6b756f7af406a1e55f211d97d10ad
1036-
faraday-multipart (1.1.1) sha256=77a18ff40149030fd1aef55bb4fc7a67ce46419a8a3fcd010e28c2526e8d8903
10371026
faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
10381027
faraday-typhoeus (2.0.0) sha256=7a459529d782994caf8ce89ca181df3adb89dd471b8ab0b3851936ab566b4dd1
10391028
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
@@ -1106,7 +1095,6 @@ CHECKSUMS
11061095
msgpack (1.8.0) sha256=e64ce0212000d016809f5048b48eb3a65ffb169db22238fb4b72472fecb2d732
11071096
multi_json (1.19.1) sha256=7aefeff8f2c854bf739931a238e4aea64592845e0c0395c8a7d2eea7fdd631b7
11081097
multi_xml (0.8.1) sha256=addba0290bac34e9088bfe73dc4878530297a82a7bbd66cb44dcd0a4b86edf5a
1109-
multipart-post (2.4.1) sha256=9872d03a8e552020ca096adadbf5e3cb1cd1cdd6acd3c161136b8a5737cdb4a8
11101098
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
11111099
net-imap (0.6.3) sha256=9bab75f876596d09ee7bf911a291da478e0cd6badc54dfb82874855ccc82f2ad
11121100
net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
@@ -1243,7 +1231,6 @@ CHECKSUMS
12431231
rubocop-rails (2.34.3) sha256=10d37989024865ecda8199f311f3faca990143fbac967de943f88aca11eb9ad2
12441232
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
12451233
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
1246-
ruby-openai (8.3.0) sha256=566dc279c42f4afed68a7a363dce2e594078abfc36b4e043102020b9a387ca69
12471234
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
12481235
rubyzip (2.4.1) sha256=8577c88edc1fde8935eb91064c5cb1aef9ad5494b940cf19c775ee833e075615
12491236
sass-embedded (1.81.0-aarch64-linux-gnu) sha256=9087759cf2f16d0a9263eb97a812dce9882ce79353cfb416f5721835ba2d8706

app.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
"AVAILABLE_WITHOUT_SIGNON_AUTHENTICATION": {
2929
"value": "true"
3030
},
31-
"OPENAI_ACCESS_TOKEN": {
32-
"required": true
33-
},
3431
"OPENSEARCH_URL": {
3532
"required": true
3633
},

app/models/question.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
class Question < ApplicationRecord
22
enum :answer_strategy,
33
{
4-
open_ai_rag_completion: "open_ai_rag_completion", # legacy strategy - no longer used
5-
openai_structured_answer: "openai_structured_answer", # legacy strategy - no longer used
64
claude_structured_answer: "claude_structured_answer",
75
non_llm_answer: "non_llm_answer", # only used during load testing, but can be present on records created during testing
86
},

app/views/static/about.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515

1616
<p class="govuk-body">
1717
GOV.UK Chat is powered by the same large language model (LLM) used on
18-
<%= link_to("OpenAI’s ChatGPT (opens in new tab)",
19-
"https://openai.com/index/chatgpt/",
18+
<%= link_to("Anthropic’s Claude (opens in new tab)",
19+
"https://claude.com/product/overview",
2020
class: "govuk-link",
2121
target: "_blank",
2222
rel: "noopener noreferrer") %>.
2323
</p>
2424

2525
<p class="govuk-body">
26-
OpenAI used millions of articles, books and other pieces of text to train
27-
the LLM. This is how ChatGPT has the language skills to respond like a human.
26+
Anthropic used millions of articles, books and other pieces of text to train
27+
the LLM. This is how Claude has the language skills to respond like a human.
2828
</p>
2929

3030
<p class="govuk-body">
@@ -46,7 +46,7 @@
4646
<h3 class="govuk-heading-s">Hallucination</h3>
4747

4848
<p class="govuk-body">
49-
The biggest limitation of emerging technologies like ChatGPT and GOV.UK
49+
The biggest limitation of emerging technologies like Claude and GOV.UK
5050
Chat is a problem known as hallucination.
5151
</p>
5252

config/application.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ class Application < Rails::Application
6666
api_questions_per_page: 50,
6767
)
6868

69-
config.openai_access_token = ENV["OPENAI_ACCESS_TOKEN"]
70-
config.openai_request_timeout = 45
71-
7269
config.answer_statuses = Hashie::Mash.new(YAML.load_file("#{__dir__}/answer_statuses.yml"))
7370
config.question_routing_labels = Hashie::Mash.new(YAML.load_file("#{__dir__}/question_routing_labels.yml"))
7471
config.search = Hashie::Mash.new(YAML.load_file("#{__dir__}/search.yml", aliases: true))

config/environments/test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,5 @@
4040
# Raise error when a before_action's only/except options reference missing actions.
4141
config.action_controller.raise_on_missing_callback_actions = true
4242

43-
# Use a hardcoded config value for testing
44-
config.openai_access_token = "fake-openai-access-token"
45-
4643
config.conversation_js_progressive_disclosure_delay = 0
4744
end

config/routes.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
GovukHealthcheck::ActiveRecord,
1111
GovukHealthcheck::SidekiqRedis,
1212
GovukHealthcheck::RailsCache,
13-
Healthcheck::OpenAI,
1413
Healthcheck::Opensearch,
1514
Healthcheck::Bedrock,
1615
)

docs/guardrails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The output of the LLM is as follows:
3434

3535
We map these to meaningful names using the mappings from a config file, e.g. [here](../config/llm_prompts/answer_guardrails.yml).
3636

37-
The file also contains the prompts we use to run the guardrails. Copy/paste these into the [OpenAI chat playground](https://platform.openai.com/playground/chat?models=gpt-4o) to investigate any issues.
37+
The file also contains the prompts we use to run the guardrails. Copy/paste these into the [Anthropic workbench](https://platform.claude.com/workbench) to investigate any issues.
3838

3939
You can also use the playground to ask the reasoning behind any response it gives.
4040

0 commit comments

Comments
 (0)