Spaces:
Sleeping
Sleeping
Update xpipe_wiki/manager_factory.py
Browse files
xpipe_wiki/manager_factory.py
CHANGED
|
@@ -9,11 +9,10 @@ class XPipeRobotRevision(enum.Enum):
|
|
| 9 |
SIMPLE_OPENAI_VERSION_0 = 1
|
| 10 |
|
| 11 |
|
| 12 |
-
CAPABLE = dict
|
| 13 |
|
| 14 |
|
| 15 |
class XPipeRobotManagerFactory:
|
| 16 |
-
|
| 17 |
@classmethod
|
| 18 |
def get_or_create(cls, revision: XPipeRobotRevision) -> XPipeWikiRobotManager:
|
| 19 |
if CAPABLE.get(revision) is not None:
|
|
@@ -25,18 +24,24 @@ class XPipeRobotManagerFactory:
|
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
def create_simple_openai_version_0(cls) -> AzureXPipeWikiRobotManager:
|
| 28 |
-
|
| 29 |
from llama.context import AzureServiceContextManager
|
| 30 |
from langchain_manager.manager import LangChainAzureManager
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
from llama.context import LocalStorageContextManager
|
| 34 |
-
dataset_path = os.getenv("XPIPE_WIKI_DATASET_PATH", "./dataset")
|
| 35 |
-
storage_context_manager = LocalStorageContextManager(dataset_path=dataset_path,
|
| 36 |
-
service_context_manager=service_context_manager)
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
LifecycleHelper.initialize_if_possible(robot_manager)
|
| 41 |
LifecycleHelper.start_if_possible(robot_manager)
|
| 42 |
return robot_manager
|
|
|
|
| 9 |
SIMPLE_OPENAI_VERSION_0 = 1
|
| 10 |
|
| 11 |
|
| 12 |
+
CAPABLE = dict()
|
| 13 |
|
| 14 |
|
| 15 |
class XPipeRobotManagerFactory:
|
|
|
|
| 16 |
@classmethod
|
| 17 |
def get_or_create(cls, revision: XPipeRobotRevision) -> XPipeWikiRobotManager:
|
| 18 |
if CAPABLE.get(revision) is not None:
|
|
|
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
def create_simple_openai_version_0(cls) -> AzureXPipeWikiRobotManager:
|
|
|
|
| 27 |
from llama.context import AzureServiceContextManager
|
| 28 |
from langchain_manager.manager import LangChainAzureManager
|
| 29 |
+
|
| 30 |
+
service_context_manager = AzureServiceContextManager(
|
| 31 |
+
lc_manager=LangChainAzureManager()
|
| 32 |
+
)
|
| 33 |
|
| 34 |
from llama.context import LocalStorageContextManager
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
dataset_path = os.getenv("XPIPE_WIKI_DATASET_PATH", "./dataset")
|
| 37 |
+
storage_context_manager = LocalStorageContextManager(
|
| 38 |
+
dataset_path=dataset_path, service_context_manager=service_context_manager
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
robot_manager = AzureXPipeWikiRobotManager(
|
| 42 |
+
service_context_manager=service_context_manager,
|
| 43 |
+
storage_context_manager=storage_context_manager,
|
| 44 |
+
)
|
| 45 |
LifecycleHelper.initialize_if_possible(robot_manager)
|
| 46 |
LifecycleHelper.start_if_possible(robot_manager)
|
| 47 |
return robot_manager
|