ai_chatbot 0.1.6.5.2 → 0.1.6.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ai_chatbot/version.rb +1 -1
- data/lib/ml_model.py +8 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6770f603f97cd518f4828cb842b7915b65e24c619478d19909b9dc3e90b9c8c1
|
4
|
+
data.tar.gz: 479705d36b32257da30e7dca7c9ebe02fc5ecaaff8e5c1b582858fd25388f444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49886819c1877e5dbcd8c5e2a8ea1f563dbe458fbefc873eb00f6cca99616bd7d7f1d46e1e0353ce2cd339889267ce76d5d54bc74b1fe8622b50d9d004c52b17
|
7
|
+
data.tar.gz: de63ca9e32ce1306eca403f6b8d449ff9f84e577bddc48f75a42c58566f39958c57bc729f375b147486b67761672a289dbbe24036a72147711e2f115a88df804
|
data/lib/ai_chatbot/version.rb
CHANGED
data/lib/ml_model.py
CHANGED
@@ -21,7 +21,7 @@ def load_data():
|
|
21
21
|
model_data = pickle.load(f)
|
22
22
|
questions = model_data.get('questions', [])
|
23
23
|
answers = model_data.get('answers', [])
|
24
|
-
print(f"Loaded {len(questions)} Q&A pairs.")
|
24
|
+
# print(f" Loaded {len(questions)} Q&A pairs.")
|
25
25
|
else:
|
26
26
|
# Default seed data
|
27
27
|
questions.extend([
|
@@ -34,7 +34,7 @@ def load_data():
|
|
34
34
|
"Migration is a database schema change.",
|
35
35
|
"You can add a route in the config/routes.rb file."
|
36
36
|
])
|
37
|
-
print("No existing model found, using default seed data.")
|
37
|
+
print(" No existing model found, using default seed data.")
|
38
38
|
|
39
39
|
retrain_model()
|
40
40
|
|
@@ -53,11 +53,11 @@ def get_prediction(query):
|
|
53
53
|
similarities = cosine_similarity(query_vec, question_vecs)
|
54
54
|
max_similarity = similarities.max()
|
55
55
|
|
56
|
-
print(f"🔍 Similarity Score: {max_similarity:.2f}")
|
56
|
+
#print(f"🔍 Similarity Score: {max_similarity:.2f}")
|
57
57
|
|
58
58
|
threshold = 0.65
|
59
59
|
if max_similarity < threshold:
|
60
|
-
return "No good match found. You may need to train the model with this question."
|
60
|
+
return " No good match found. You may need to train the model with this question."
|
61
61
|
else:
|
62
62
|
prediction = model.predict([query])
|
63
63
|
return prediction[0]
|
@@ -75,8 +75,8 @@ def update_answer(existing_question, new_answer):
|
|
75
75
|
answers[idx] = new_answer
|
76
76
|
retrain_model()
|
77
77
|
save_data()
|
78
|
-
return f"Answer updated for: '{existing_question}'"
|
79
|
-
return "Question not found."
|
78
|
+
return f" Answer updated for: '{existing_question}'"
|
79
|
+
return " Question not found."
|
80
80
|
|
81
81
|
def update_or_delete_question(existing_question, new_question=None):
|
82
82
|
if existing_question in questions:
|
@@ -91,7 +91,7 @@ def update_or_delete_question(existing_question, new_question=None):
|
|
91
91
|
retrain_model()
|
92
92
|
save_data()
|
93
93
|
return action
|
94
|
-
return "Question not found."
|
94
|
+
return " Question not found."
|
95
95
|
|
96
96
|
def list_questions():
|
97
97
|
return "\n".join([f"{i+1}. {q}" for i, q in enumerate(questions)])
|
@@ -116,7 +116,7 @@ def main(action, query=None, answer=None):
|
|
116
116
|
elif action == "list_answers":
|
117
117
|
return list_answers()
|
118
118
|
else:
|
119
|
-
return "Unknown action. Try: predict, train_model, update_answer, list_questions, list_answers"
|
119
|
+
return " Unknown action. Try: predict, train_model, update_answer, list_questions, list_answers"
|
120
120
|
|
121
121
|
if __name__ == "__main__":
|
122
122
|
action = sys.argv[1] if len(sys.argv) > 1 else None
|
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.6.5.
|
4
|
+
version: 0.1.6.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sanket
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open3
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: fixed model error. Version 0.1.6.5.
|
27
|
+
description: fixed model error. Version 0.1.6.5.3 Details on Git.
|
28
28
|
email:
|
29
29
|
- sanket.tikhande@gmail.com
|
30
30
|
executables: []
|
@@ -57,5 +57,5 @@ requirements: []
|
|
57
57
|
rubygems_version: 3.3.7
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
|
-
summary: 'Fix: Added high accuracy'
|
60
|
+
summary: 'Fix: Added PKl Db and high accuracy'
|
61
61
|
test_files: []
|