ai_chatbot 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44d4375b7617e626f0ece5d48d9951db6cbb29d40fc039ed432f57f95214ff61
4
- data.tar.gz: b47d32642a89b0a8ee430d210d57fa310616828938e431cf5b9094b1720e9d92
3
+ metadata.gz: 12bcba7047f40d05685eec1c6a6714d7b8b6d57b092df1dcf6e382040af48182
4
+ data.tar.gz: ede7b3ccff3faecf008c681c649f7ac3732bebbd2a46f7801a313a0d64507ce4
5
5
  SHA512:
6
- metadata.gz: 2b85bdabf2fcf579a8355ef6b847251b6f1a715ef648a70bdbff1d4807f3615b425c50b80ce54f653477ae4c4caa163c8614e9563364a75145ff346b369077c3
7
- data.tar.gz: 1fd7b59dde9c05e0ebca46fb472365786e7dbeb6440d2b30c7a0239246343efb8c3cb617aad4a83c48af2c3d18daab3726aaf6f672ea20b33bfbaa012995b94c
6
+ metadata.gz: 991397292bed26854442cc630a87539fbb3ccba1cf81f6af673db57b607e56fdf150d4d905b00709b2c81ea6b4510759d7785f6ba16e44d58eab6e371b4ee581
7
+ data.tar.gz: f5312f608a08cffac6ef4ad93b4e7aed47191fdf0af0b7337a93bc13a9605e09db4eec91176b7dcc16c155af310d38d359fb03314bdd918b291f008579b56926
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiChatbot
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/ml_model.py CHANGED
@@ -48,7 +48,7 @@ def get_prediction(query):
48
48
  similarities = cosine_similarity(query_vec, question_vecs)
49
49
  max_similarity = similarities.max()
50
50
 
51
- threshold = 0.70
51
+ threshold = 0.65
52
52
  if max_similarity < threshold:
53
53
  return "No good match found. Please provide the correct answer."
54
54
  else:
@@ -89,6 +89,23 @@ def update_answer(existing_question, new_answer):
89
89
  else:
90
90
  return "Question not found. Please provide a valid question."
91
91
 
92
+ def update_question(existing_question, new_question):
93
+ global existing_question, new_question
94
+
95
+ if existing_question in questions:
96
+ # Find the index of the existing question
97
+ index = questions.index(existing_question)
98
+ # Update the answer
99
+ existing_question[index] = new_question
100
+ # Retrain the model with updated data
101
+ model.fit(questions, answers)
102
+ # Save the updated model and data
103
+ with open("qa_model.pkl", "wb") as f:
104
+ pickle.dump({"questions": questions, "answers": answers}, f)
105
+ return f"New question updated for the question: '{existing_question}'"
106
+ else:
107
+ return "Question not found. Please provide a valid question."
108
+
92
109
  def list_questions():
93
110
  global questions
94
111
  return questions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai_chatbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - Sanet
7
+ - Sanket
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-17 00:00:00.000000000 Z
11
+ date: 2024-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open3
@@ -35,10 +35,11 @@ files:
35
35
  - lib/ai_chatbot.rb
36
36
  - lib/ai_chatbot/version.rb
37
37
  - lib/ml_model.py
38
- homepage:
38
+ homepage: https://github.com/tikhandesanket/ai-chatbot
39
39
  licenses:
40
40
  - MIT
41
- metadata: {}
41
+ metadata:
42
+ source_code_uri: https://github.com/tikhandesanket/ai-chatbot
42
43
  post_install_message:
43
44
  rdoc_options: []
44
45
  require_paths: