captain-awesome commited on
Commit
7b694bd
1 Parent(s): 778fb21

Create llmware_module.py

Browse files
Files changed (1) hide show
  1. llmware_module.py +47 -0
llmware_module.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llmware.models import ModelCatalog
2
+ from llmware.prompts import Prompt
3
+
4
+ def classify_sentiment(text):
5
+ sentiment_model = ModelCatalog().load_model("slim-sentiment-tool")
6
+ response_sentiment = sentiment_model.function_call(text, get_logits=False)
7
+ return response_sentiment
8
+
9
+ def detect_emotions(text):
10
+ emotions_model = ModelCatalog().load_model("slim-emotions-tool")
11
+ response_emotions = emotions_model.function_call(text, get_logits=False)
12
+ return response_emotions
13
+
14
+ def generate_tags(text):
15
+ tags_model = ModelCatalog().load_model("slim-tags-tool")
16
+ response_tags = tags_model.function_call(text, get_logits=False)
17
+ return response_tags
18
+
19
+ def identify_topics(text):
20
+ topics_model = ModelCatalog().load_model("slim-topics-tool")
21
+ response_topics = topics_model.function_call(text, get_logits=False)
22
+ return response_topics
23
+
24
+ def perform_intent(text):
25
+ intent_model = ModelCatalog().load_model("slim-intent-tool")
26
+ response_intent = intent_model.function_call(text)
27
+ return response_intent
28
+
29
+ def get_ratings(text):
30
+ ratings_model = ModelCatalog().load_model("slim-ratings-tool")
31
+ response_ratings = ratings_model.function_call(text)
32
+ return response_ratings
33
+
34
+ def get_category(text):
35
+ category_model = ModelCatalog().load_model("slim-category-tool")
36
+ response_category = category_model.function_call(text)
37
+ return response_category
38
+
39
+ def perform_ner(text):
40
+ ner_model = ModelCatalog().load_model("slim-ner-tool")
41
+ response_ner = ner_model.function_call(text)
42
+ return response_ner
43
+
44
+ def perform_nli(text):
45
+ nli_model = ModelCatalog().load_model("slim-nli-tool")
46
+ response_nli = nli_model.function_call(text)
47
+ return response_nli