__init__.py
2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from bertopic._utils import NotInstalled
from bertopic.representation._cohere import Cohere
from bertopic.representation._base import BaseRepresentation
from bertopic.representation._keybert import KeyBERTInspired
from bertopic.representation._mmr import MaximalMarginalRelevance
# Llama CPP Generator
try:
from bertopic.representation._llamacpp import LlamaCPP
except ModuleNotFoundError:
msg = "`pip install llama-cpp-python` \n\n"
LlamaCPP = NotInstalled("llama.cpp", "llama-cpp-python", custom_msg=msg)
# Text Generation using transformers
try:
from bertopic.representation._textgeneration import TextGeneration
except ModuleNotFoundError:
msg = "`pip install bertopic` without `--no-deps` \n\n"
TextGeneration = NotInstalled("TextGeneration", "transformers", custom_msg=msg)
# Zero-shot classification using transformers
try:
from bertopic.representation._zeroshot import ZeroShotClassification
except ModuleNotFoundError:
msg = "`pip install bertopic` without `--no-deps` \n\n"
ZeroShotClassification = NotInstalled("ZeroShotClassification", "transformers", custom_msg=msg)
# OpenAI Generator
try:
from bertopic.representation._openai import OpenAI
except ModuleNotFoundError:
msg = "`pip install openai` \n\n"
OpenAI = NotInstalled("OpenAI", "openai", custom_msg=msg)
# LiteLLM Generator
try:
from bertopic.representation._litellm import LiteLLM
except ModuleNotFoundError:
msg = "`pip install litellm` \n\n"
LiteLLM = NotInstalled("LiteLLM", "litellm", custom_msg=msg)
# LangChain Generator
try:
from bertopic.representation._langchain import LangChain
except ModuleNotFoundError:
msg = "`pip install langchain` \n\n"
LangChain = NotInstalled("langchain", "langchain", custom_msg=msg)
# POS using Spacy
try:
from bertopic.representation._pos import PartOfSpeech
except ModuleNotFoundError:
PartOfSpeech = NotInstalled("Part of Speech with Spacy", "spacy")
# Multimodal
try:
from bertopic.representation._visual import VisualRepresentation
except ModuleNotFoundError:
VisualRepresentation = NotInstalled("a visual representation model", "vision")
__all__ = [
"BaseRepresentation",
"TextGeneration",
"ZeroShotClassification",
"KeyBERTInspired",
"PartOfSpeech",
"MaximalMarginalRelevance",
"Cohere",
"OpenAI",
"LangChain",
"LiteLLM",
"LlamaCPP",
"VisualRepresentation",
]