ai_chatbot 0.1.5 → 0.1.6

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: 06bf16d383baea57ccc0bdbdcd1e041683130f0ef85120ca5af04b24cf64bbf9
4
- data.tar.gz: d98da511ebcfbc645ffd5182db2e3c31703786714f98fb0374ec203386644439
3
+ metadata.gz: 726472f08ac5fcbed289fcd127215efb58823399b4c1e960ef4a9ae35a4ce368
4
+ data.tar.gz: 59cc5bbe59655f7863970fb32ee66279d308208af82b5ca7d3462748146972de
5
5
  SHA512:
6
- metadata.gz: c4e7bf28f9d9b7568aa3dbe736b546018315f1d4dabd5b2d3ceff26dc3e12fc396f8ae35f32236900b8c39f8a1eadf889c93e8ba6bb37cebc14ef7402bcc0606
7
- data.tar.gz: 8fdba9ecec76779184a18098395ba4a6d3b173c4e788ed40d0c3f2c2300a4ad2fb4a05a41928e82995fe7ad39d95576b996aa5e78d17dc54826a48243d2bab64
6
+ metadata.gz: 4611e846bcb29c1a0f5466a7b9269640ab8bb74ad8bb221e885f0c5fe07d2ec92e9a98aedec1b855fcc8ff6590a885c8f3522e4d8b5863724e7495ebc2a963fe
7
+ data.tar.gz: bb5dfc83841117e9f001d7691fa0fc4a1d439bf53cd7dc535b34a2f5a1f3b24c999d5a34d8cc407af7f4a036128fd280cf8998804c346a07364251bf885176ba
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiChatbot
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
data/lib/ml_model.py CHANGED
@@ -37,7 +37,7 @@ def main(action, query=None, new_answer=None):
37
37
  elif action == "update_answer":
38
38
  return update_answer(query, new_answer)
39
39
  elif action == "update_question":
40
- return update_answer(query, new_question)
40
+ return update_question(query, new_answer) # Corrected here, calling the right function
41
41
  elif action == "list_questions":
42
42
  return list_questions()
43
43
 
@@ -92,21 +92,21 @@ def update_answer(existing_question, new_answer):
92
92
  return "Question not found. Please provide a valid question."
93
93
 
94
94
  def update_question(existing_question, new_question):
95
- global questions, new_question
95
+ global questions # Only 'questions' is global, not 'new_question'
96
96
 
97
97
  if existing_question in questions:
98
98
  # Find the index of the existing question
99
99
  index = questions.index(existing_question)
100
- # Update the answer
101
- existing_question[index] = new_question
100
+ # Update the question
101
+ questions[index] = new_question
102
102
  # Retrain the model with updated data
103
103
  model.fit(questions, answers)
104
104
  # Save the updated model and data
105
105
  with open("qa_model.pkl", "wb") as f:
106
106
  pickle.dump({"questions": questions, "answers": answers}, f)
107
- return f"New question updated for the question: '{existing_question}'"
107
+ return f"Question updated from '{existing_question}' to '{new_question}'"
108
108
  else:
109
- return "Question not found. Please provide a valid question."
109
+ return "Question not found. Please provide a valid question."
110
110
 
111
111
  def list_questions():
112
112
  global questions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai_chatbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanket