Spaces:
Sleeping
Sleeping
NickNYU
commited on
Commit
·
175a385
1
Parent(s):
b8417fc
add modulars
Browse files- .idea/.gitignore +8 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/llama-xpipe.iml +10 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- core/__pycache__/__init__.cpython-310.pyc +0 -0
- core/__pycache__/lifecycle.cpython-310.pyc +0 -0
- core/__pycache__/logger_factory.cpython-310.pyc +0 -0
- core/__pycache__/test_lifecycle.cpython-310.pyc +0 -0
- core/lifecycle.py +138 -7
- core/lifecycle_control.py +0 -24
- core/logger_factory.py +21 -0
- core/test_lifecycle.py +59 -0
- data/coffee_learn.pdf +0 -0
- dataset/docstore.json +0 -1
- dataset/graph_store.json +0 -1
- dataset/index_store.json +0 -1
- dataset/vector_store.json +0 -0
- docs.pkl +0 -0
- enum_check.py +0 -58
- {data_initializer → langchain}/__init__.py +0 -0
- langchain/manager.py +38 -0
- llama/__init__.py +0 -0
- llama/context.py +53 -0
- llama/data_loader.py +58 -0
- llama/index.py +15 -0
- llama/vector_storage.py +19 -0
- requirements.txt +1 -1
.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
4 |
+
# Editor-based HTTP Client requests
|
5 |
+
/httpRequests/
|
6 |
+
# Datasource local storage ignored files
|
7 |
+
/dataSources/
|
8 |
+
/dataSources.local.xml
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/llama-xpipe.iml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$">
|
5 |
+
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
6 |
+
</content>
|
7 |
+
<orderEntry type="jdk" jdkName="Python 3.10 (llama-xpipe)" jdkType="Python SDK" />
|
8 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
9 |
+
</component>
|
10 |
+
</module>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (llama-xpipe)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/llama-xpipe.iml" filepath="$PROJECT_DIR$/.idea/llama-xpipe.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
core/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (147 Bytes). View file
|
|
core/__pycache__/lifecycle.cpython-310.pyc
ADDED
Binary file (6.82 kB). View file
|
|
core/__pycache__/logger_factory.cpython-310.pyc
ADDED
Binary file (778 Bytes). View file
|
|
core/__pycache__/test_lifecycle.cpython-310.pyc
ADDED
Binary file (2.54 kB). View file
|
|
core/lifecycle.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
-
|
|
|
|
|
2 |
|
3 |
-
from core
|
4 |
-
import atomic
|
5 |
|
6 |
|
7 |
class Initializable(ABC):
|
@@ -10,6 +11,7 @@ class Initializable(ABC):
|
|
10 |
def initialize(self) -> None:
|
11 |
pass
|
12 |
|
|
|
13 |
class Startable(ABC):
|
14 |
@abstractmethod
|
15 |
def start(self) -> None:
|
@@ -29,13 +31,142 @@ class Disposable(ABC):
|
|
29 |
def dispose(self) -> None:
|
30 |
pass
|
31 |
|
32 |
-
class Lifecycle(ABC, Initializable, Startable, Stoppable, Disposable, LifecycleAware):
|
33 |
-
pass
|
34 |
|
35 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
|
|
|
|
|
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
|
|
|
|
|
|
|
1 |
+
import enum
|
2 |
+
from abc import ABC, abstractmethod
|
3 |
+
from typing import TypeVar
|
4 |
|
5 |
+
from core import logger_factory
|
|
|
6 |
|
7 |
|
8 |
class Initializable(ABC):
|
|
|
11 |
def initialize(self) -> None:
|
12 |
pass
|
13 |
|
14 |
+
|
15 |
class Startable(ABC):
|
16 |
@abstractmethod
|
17 |
def start(self) -> None:
|
|
|
31 |
def dispose(self) -> None:
|
32 |
pass
|
33 |
|
|
|
|
|
34 |
|
35 |
+
class LifecycleAware(ABC):
|
36 |
+
|
37 |
+
def __init__(self, state):
|
38 |
+
self.state = state
|
39 |
+
|
40 |
+
def get_lifecycle_state(self):
|
41 |
+
return self.state
|
42 |
+
|
43 |
+
|
44 |
+
class Lifecycle(Initializable, Startable, Stoppable, Disposable, LifecycleAware, ABC):
|
45 |
|
46 |
def __init__(self):
|
47 |
+
self.logger = logger_factory.get_logger(self.__class__.__name__)
|
48 |
+
self.lifecycle_state = LifecycleState(lifecycle=self)
|
49 |
+
|
50 |
+
def initialize(self):
|
51 |
+
if not self.lifecycle_state.can_initialize(self.lifecycle_state.get_phase()):
|
52 |
+
self.logger.warning("[{}]cannot initialize".format(self.__class__.__name__))
|
53 |
+
return
|
54 |
+
self.lifecycle_state.set_phase(LifecyclePhase.INITIALIZING)
|
55 |
+
self.do_init()
|
56 |
+
self.lifecycle_state.set_phase(LifecyclePhase.INITIALIZED)
|
57 |
+
|
58 |
+
def start(self):
|
59 |
+
if not self.lifecycle_state.can_start(self.lifecycle_state.get_phase()):
|
60 |
+
self.logger.warning("[{}]cannot start".format(self.__class__.__name__))
|
61 |
+
return
|
62 |
+
self.lifecycle_state.set_phase(LifecyclePhase.STARTING)
|
63 |
+
self.do_start()
|
64 |
+
self.lifecycle_state.set_phase(LifecyclePhase.STARTED)
|
65 |
+
|
66 |
+
def stop(self):
|
67 |
+
if not self.lifecycle_state.can_stop(self.lifecycle_state.get_phase()):
|
68 |
+
self.logger.warning("[{}]cannot stop".format(self.__class__.__name__))
|
69 |
+
return
|
70 |
+
self.lifecycle_state.set_phase(LifecyclePhase.STOPPING)
|
71 |
+
self.do_stop()
|
72 |
+
self.lifecycle_state.set_phase(LifecyclePhase.STOPPED)
|
73 |
+
|
74 |
+
def dispose(self):
|
75 |
+
if not self.lifecycle_state.can_dispose(self.lifecycle_state.get_phase()):
|
76 |
+
self.logger.warning("[{}]cannot dispose".format(self.__class__.__name__))
|
77 |
+
return
|
78 |
+
self.lifecycle_state.set_phase(LifecyclePhase.DISPOSING)
|
79 |
+
self.do_dispose()
|
80 |
+
self.lifecycle_state.set_phase(LifecyclePhase.DISPOSED)
|
81 |
|
82 |
+
@abstractmethod
|
83 |
+
def do_init(self):
|
84 |
+
pass
|
85 |
|
86 |
+
@abstractmethod
|
87 |
+
def do_start(self):
|
88 |
+
pass
|
89 |
+
|
90 |
+
@abstractmethod
|
91 |
+
def do_stop(self):
|
92 |
+
pass
|
93 |
+
|
94 |
+
@abstractmethod
|
95 |
+
def do_dispose(self):
|
96 |
+
pass
|
97 |
+
|
98 |
+
|
99 |
+
class LifecyclePhase(enum.Enum):
|
100 |
+
INITIALIZING = 1
|
101 |
+
INITIALIZED = 2
|
102 |
+
STARTING = 3
|
103 |
+
STARTED = 4
|
104 |
+
STOPPING = 5
|
105 |
+
STOPPED = 6
|
106 |
+
DISPOSING = 7
|
107 |
+
DISPOSED = 8
|
108 |
+
|
109 |
+
|
110 |
+
class LifecycleController(ABC):
|
111 |
+
|
112 |
+
def can_initialize(self, phase: [LifecyclePhase]) -> bool:
|
113 |
+
return phase is None or phase == LifecyclePhase.DISPOSED
|
114 |
+
|
115 |
+
def can_start(self, phase: [LifecyclePhase]) -> bool:
|
116 |
+
return phase is not None and (
|
117 |
+
phase == LifecyclePhase.INITIALIZED or phase == LifecyclePhase.STOPPED)
|
118 |
+
|
119 |
+
def can_stop(self, phase: [LifecyclePhase]) -> bool:
|
120 |
+
return phase is not None and phase == LifecyclePhase.STARTED
|
121 |
+
|
122 |
+
def can_dispose(self, phase: [LifecyclePhase]) -> bool:
|
123 |
+
return phase is not None and (
|
124 |
+
phase == LifecyclePhase.INITIALIZED or phase == LifecyclePhase.STOPPED)
|
125 |
+
|
126 |
+
|
127 |
+
LS = TypeVar("LS", bound=Lifecycle)
|
128 |
+
|
129 |
+
|
130 |
+
class LifecycleState(LifecycleController, ABC):
|
131 |
+
|
132 |
+
def __init__(self, lifecycle: [LS]):
|
133 |
+
self.phase = None
|
134 |
+
self.prev_phase = None
|
135 |
+
self.lifecycle = lifecycle
|
136 |
+
self.logger = logger_factory.get_logger(__name__)
|
137 |
+
|
138 |
+
def is_initializing(self) -> bool:
|
139 |
+
return self.phase == LifecyclePhase.INITIALIZING
|
140 |
+
|
141 |
+
def is_initialized(self) -> bool:
|
142 |
+
return self.phase == LifecyclePhase.INITIALIZED
|
143 |
+
|
144 |
+
def is_starting(self) -> bool:
|
145 |
+
return self.phase == LifecyclePhase.STARTING
|
146 |
+
|
147 |
+
def is_started(self) -> bool:
|
148 |
+
return self.phase == LifecyclePhase.STARTED
|
149 |
+
|
150 |
+
def is_stopping(self) -> bool:
|
151 |
+
return self.phase == LifecyclePhase.STOPPING
|
152 |
+
|
153 |
+
def is_stopped(self) -> bool:
|
154 |
+
return self.phase == LifecyclePhase.STOPPED
|
155 |
+
|
156 |
+
def is_disposing(self) -> bool:
|
157 |
+
return self.phase == LifecyclePhase.DISPOSING
|
158 |
+
|
159 |
+
def is_disposed(self) -> bool:
|
160 |
+
return self.phase == LifecyclePhase.DISPOSED
|
161 |
+
|
162 |
+
def get_phase(self) -> LifecyclePhase:
|
163 |
+
return self.phase
|
164 |
+
|
165 |
+
def set_phase(self, phase: [LifecyclePhase]) -> None:
|
166 |
+
prev = "None" if self.phase is None else self.phase.name
|
167 |
+
self.logger.info("[setPhaseName][{}]{} --> {}".format(self.lifecycle.__class__.__name__, prev, phase.name))
|
168 |
+
self.phase = phase
|
169 |
|
170 |
+
def rollback(self, err: [Exception]) -> None:
|
171 |
+
self.phase = self.prev_phase
|
172 |
+
self.prev_phase = None
|
core/lifecycle_control.py
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
from abc import ABC, abstractmethod
|
2 |
-
|
3 |
-
|
4 |
-
class LifecycleState(ABC):
|
5 |
-
@abstractmethod
|
6 |
-
def is_initializable(self) -> bool:
|
7 |
-
pass
|
8 |
-
|
9 |
-
@abstractmethod
|
10 |
-
def is_startable(self) -> bool:
|
11 |
-
pass
|
12 |
-
|
13 |
-
@abstractmethod
|
14 |
-
def is_stoppable(self) -> bool:
|
15 |
-
pass
|
16 |
-
|
17 |
-
@abstractmethod
|
18 |
-
def is_disposable(self) -> bool:
|
19 |
-
pass
|
20 |
-
|
21 |
-
class LifecycleAware(ABC):
|
22 |
-
@abstractmethod
|
23 |
-
def get_lifecycle_state(self) -> LifecycleState:
|
24 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core/logger_factory.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from logging import handlers
|
3 |
+
from typing import Optional
|
4 |
+
|
5 |
+
|
6 |
+
def get_logger(name: [str],
|
7 |
+
file_name: Optional[str] = None) -> logging.Logger:
|
8 |
+
logger = logging.getLogger(name)
|
9 |
+
if file_name is None:
|
10 |
+
file_name = 'app-default.log'
|
11 |
+
handler = handlers.TimedRotatingFileHandler(filename=file_name,
|
12 |
+
when='d',
|
13 |
+
backupCount=21,
|
14 |
+
encoding='UTF-8')
|
15 |
+
formatter = logging.Formatter('[%(asctime)s][%(levelname)s][%(message)s]')
|
16 |
+
handler.setFormatter(formatter)
|
17 |
+
logger.addHandler(handler)
|
18 |
+
logger.setLevel(logging.INFO)
|
19 |
+
# Configure the logger as desired
|
20 |
+
# e.g., add handlers, set log levels, etc.
|
21 |
+
return logger
|
core/test_lifecycle.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from unittest import TestCase
|
3 |
+
|
4 |
+
from core.lifecycle import Lifecycle
|
5 |
+
|
6 |
+
logging.basicConfig()
|
7 |
+
|
8 |
+
|
9 |
+
class SubLifecycle(Lifecycle):
|
10 |
+
|
11 |
+
def __init__(self):
|
12 |
+
super().__init__()
|
13 |
+
self.init_counter = 0
|
14 |
+
|
15 |
+
def do_init(self):
|
16 |
+
self.init_counter += 1
|
17 |
+
|
18 |
+
def do_start(self):
|
19 |
+
self.init_counter += 1
|
20 |
+
|
21 |
+
def do_stop(self):
|
22 |
+
self.init_counter += 1
|
23 |
+
|
24 |
+
def do_dispose(self):
|
25 |
+
self.init_counter += 1
|
26 |
+
|
27 |
+
|
28 |
+
class TestLifecycle(TestCase):
|
29 |
+
def test_initialize(self):
|
30 |
+
ls = SubLifecycle()
|
31 |
+
ls.initialize()
|
32 |
+
ls.logger.info(ls.lifecycle_state.get_phase().name)
|
33 |
+
ls.start()
|
34 |
+
ls.logger.info(ls.lifecycle_state.get_phase().name)
|
35 |
+
ls.stop()
|
36 |
+
ls.logger.info(ls.lifecycle_state.get_phase().name)
|
37 |
+
ls.dispose()
|
38 |
+
ls.logger.info(ls.lifecycle_state.get_phase().name)
|
39 |
+
|
40 |
+
def test_start(self):
|
41 |
+
self.fail()
|
42 |
+
|
43 |
+
def test_stop(self):
|
44 |
+
self.fail()
|
45 |
+
|
46 |
+
def test_dispose(self):
|
47 |
+
self.fail()
|
48 |
+
|
49 |
+
def test_do_init(self):
|
50 |
+
self.fail()
|
51 |
+
|
52 |
+
def test_do_start(self):
|
53 |
+
self.fail()
|
54 |
+
|
55 |
+
def test_do_stop(self):
|
56 |
+
self.fail()
|
57 |
+
|
58 |
+
def test_do_dispose(self):
|
59 |
+
self.fail()
|
data/coffee_learn.pdf
DELETED
Binary file (121 kB)
|
|
dataset/docstore.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"docstore/metadata": {"bc683a46-28f1-431b-ac3b-aa12c6ddd43d": {"doc_hash": "ae4dd1d6bf7dbfde8eb91ae53b904c9cfe1bb9c7cd3c47bb5268b034f36eb9be"}, "2b996509-1fd2-4b54-96e2-0262d80f8094": {"doc_hash": "9e6cdb76abd720f9d9f5d296df9e163b96268419fce733e5c5a6a3e79b3ce199"}, "9e7cf718-f627-4de4-8df8-e7586b086398": {"doc_hash": "dad19fbda7f756cf59320779a7fc243126a47a132e7b8212b38b4353020cecda"}, "aa8ce8f2-c971-4a8a-aac3-0131c9ac9470": {"doc_hash": "a3e842b09f05dccd3bc3524c0f0d6760ec3ad6ab606badbde65be6a29d2128ba"}, "0505f5a7-29ac-4744-a877-79f2befc7c56": {"doc_hash": "6da7612e744ac748bd017c442f0e87017f5bbade2b9dc30cc32fa937fb11566f", "ref_doc_id": "bc683a46-28f1-431b-ac3b-aa12c6ddd43d"}, "df50d309-1f12-4324-9231-c9d19f85e943": {"doc_hash": "5e7ae7f905652c0b30d826a631a70bcbf5841ce0fd0723637ce862ed3041eeaf", "ref_doc_id": "bc683a46-28f1-431b-ac3b-aa12c6ddd43d"}, "5d6284ed-36c0-4a96-bdfb-783fcea19c35": {"doc_hash": "d18c8eff53d088c49deae1dac8a3421f28a4a288c61bbe4370a45db684428c82", "ref_doc_id": "2b996509-1fd2-4b54-96e2-0262d80f8094"}, "7fd1a435-4c0d-46f2-ae68-5da48bcdfb57": {"doc_hash": "7b85936163d3b360d1473bfe863a2b13ad1917536e3d6437d994dbfeccfb0fa3", "ref_doc_id": "2b996509-1fd2-4b54-96e2-0262d80f8094"}, "b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39": {"doc_hash": "28c41849ae254075fdd46a9ebdbb2e9e12400aec658c21dfc248fb43a19afeda", "ref_doc_id": "9e7cf718-f627-4de4-8df8-e7586b086398"}, "896c532e-e190-4afd-8cd5-93d826d7deef": {"doc_hash": "70584d5168409fb33f388d6bd3d84d1e586d3b59ef38a2eafb4164690c692fa9", "ref_doc_id": "9e7cf718-f627-4de4-8df8-e7586b086398"}, "8338d8a7-544f-4b33-bf3e-c78f057dc679": {"doc_hash": "a3e842b09f05dccd3bc3524c0f0d6760ec3ad6ab606badbde65be6a29d2128ba", "ref_doc_id": "aa8ce8f2-c971-4a8a-aac3-0131c9ac9470"}}, "docstore/data": {"0505f5a7-29ac-4744-a877-79f2befc7c56": {"__data__": {"text": "\u8bf7\u5e2e\u6211\u751f\u621010\u6761\u5496\u5561\u83dc\u5355\u4fe1\u606f\uff0c\u5305\u62ec\u54c1\u540d\uff0c\u4e3b\u8981\u5356\u70b9\uff0c\u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff0c\u4e2d\u676f\u4ef7\u683c\uff0c\u5927\u676f \u4ef7\u683c\uff0c\u8d85\u5927\u676f\u4ef7\u683c \u793a\u4f8b\u5982\u4e0b\uff1a \u5496\u5561\u54c1\u540d\uff1a\u7c89\u7c89\u751f\u5496 \u4e3b\u8981\u5356\u70b9\uff1a\u6930\u9999\u4e0e\u5496\u9999\u5e76\u5b58\uff0c\u60ca\u8273\u4f60\u7684\u5473\u857e\uff0c\u4e3a\u708e\u708e\u590f\u65e5\u5e26\u6765\u4e00\u70b9\u820c\u5c16\u4e0a\u7684\u51b0\u723d! \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u8f7b\u5496\u5561\u56e0\u996e\u6599\uff0c\u9002\u5408\u5496\u5561\u8fc7\u654f\u4eba\u7fa4\uff0c\u7528\u7684\u662f\u71d5\u9ea6\u5976\uff0c\u4e73\u7cd6\u4e0d\u8010\u8005\u4e5f\u80fd\u559d \u4e2d\u676f\u4ef7\u683c\uff1a31\u5143 \u5927\u676f\u4ef7\u683c\uff1a34\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a37\u5143 \u597d\u7684\uff0c\u4ee5\u4e0b\u662f10\u6761\u4e0d\u540c\u7684\u5496\u5561\u83dc\u5355\u4fe1\u606f\uff1a 1.\u5496\u5561\u54c1\u540d\uff1a\u8089\u6842\u62ff\u94c1 \u4e3b\u8981\u5356\u70b9\uff1a\u6dfb\u52a0\u4e86\u8089\u6842\u9999\u6c14\uff0c\u53e3\u611f\u6e29\u6696\u8212\u9002\uff0c\u9002\u5408\u5728\u5bd2\u51b7\u7684\u5b63\u8282\u996e\u7528 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u6e29\u6696\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u51ac\u5b63\u6216\u4e0b\u5348\u8336\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a28\u5143 \u5927\u676f\u4ef7\u683c\uff1a31\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a34\u5143 2.\u5496\u5561\u54c1\u540d\uff1a\u7126\u7cd6\u739b\u5947\u6735 \u4e3b\u8981\u5356\u70b9\uff1a\u7ecf\u5178\u996e\u54c1\uff0c\u6df7\u5408\u4e86\u725b\u5976\u4e0e\u6d53\u7f29\u5496\u5561\uff0c\u52a0\u5165\u7126\u7cd6\u9171\uff0c\u53e3\u611f\u6d53\u90c1\u9999\u751c \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u590d\u6742\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u4f11\u95f2\u6216\u4e0b\u5348\u8336\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a32\u5143 \u5927\u676f\u4ef7\u683c\uff1a35\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a38\u5143 3.\u5496\u5561\u54c1\u540d\uff1a\u8f7b\u751c\u7f8e\u5f0f\u5496\u5561 \u4e3b\u8981\u5356\u70b9\uff1a\u5c06\u7f8e\u5f0f\u5496\u5561\u52a0\u5165\u4e86\u8f7b\u5fae\u7684\u7cd6\u6d46\uff0c\u8ba9\u5473\u9053\u66f4\u52a0\u6e29\u548c\u548c\u751c\u7f8e \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u7f8e\u5f0f\u5496\u5561\u4f46\u4e0d\u559c\u6b22\u82e6\u5473\u7684\u4eba\u7fa4\uff0c\u5728\u5de5\u4f5c\u6216\u5b66\u4e60\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a27\u5143", "doc_id": "0505f5a7-29ac-4744-a877-79f2befc7c56", "embedding": null, "doc_hash": "6da7612e744ac748bd017c442f0e87017f5bbade2b9dc30cc32fa937fb11566f", "extra_info": {"page_label": "1", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 0, "end": 484, "_node_type": "1"}, "relationships": {"1": "bc683a46-28f1-431b-ac3b-aa12c6ddd43d", "3": "df50d309-1f12-4324-9231-c9d19f85e943"}}, "__type__": "1"}, "df50d309-1f12-4324-9231-c9d19f85e943": {"__data__": {"text": "\u4e2d\u676f\u4ef7\u683c\uff1a27\u5143 \u5927\u676f\u4ef7\u683c\uff1a30\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a33\u5143 4.\u5496\u5561\u54c1\u540d\uff1a\u9ed1\u7cd6\u5976\u76d6\u5496\u5561 \u4e3b\u8981\u5356\u70b9\uff1a\u6253\u7834\u4f20\u7edf\uff0c\u5c06\u9ed1\u7cd6\u5976\u76d6\u548c\u6d53\u7f29\u5496\u5561\u6df7\u5408\uff0c\u53e3\u611f\u6d53\u90c1\u9999\u751c \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u5976\u76d6\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u4e0b\u5348\u8336\u6216\u4f11\u95f2\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a29\u5143 \u5927\u676f\u4ef7\u683c\uff1a32\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a35\u5143 5.\u5496\u5561\u54c1\u540d\uff1a\u9999\u8349\u62ff\u94c1 \u4e3b\u8981\u5356\u70b9\uff1a\u6dfb\u52a0\u4e86\u9999\u8349\u9999\u5473\uff0c\u53e3\u611f\u4e30\u5bcc\u7ec6\u817b\uff0c\u9002\u5408\u6574\u5929\u90fd\u559c\u6b22\u996e\u7528\u5496\u5561\u7684\u4eba\u7fa4 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u62ff\u94c1\u7684\u4eba\u7fa4\uff0c\u5728\u5de5\u4f5c\u6216\u5b66\u4e60\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a28\u5143 \u5927\u676f\u4ef7\u683c\uff1a31\u5143", "doc_id": "df50d309-1f12-4324-9231-c9d19f85e943", "embedding": null, "doc_hash": "5e7ae7f905652c0b30d826a631a70bcbf5841ce0fd0723637ce862ed3041eeaf", "extra_info": {"page_label": "1", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 476, "end": 697, "_node_type": "1"}, "relationships": {"1": "bc683a46-28f1-431b-ac3b-aa12c6ddd43d", "2": "0505f5a7-29ac-4744-a877-79f2befc7c56"}}, "__type__": "1"}, "5d6284ed-36c0-4a96-bdfb-783fcea19c35": {"__data__": {"text": "\u8d85\u5927\u676f\u4ef7\u683c\uff1a34\u5143 6.\u5496\u5561\u54c1\u540d\uff1a\u699b\u679c\u62ff\u94c1 \u4e3b\u8981\u5356\u70b9\uff1a\u6dfb\u52a0\u4e86\u699b\u679c\u9999\u5473\uff0c\u6d53\u90c1\u7684\u53e3\u611f\u548c\u9999\u5473\uff0c\u8ba9\u60a8\u66f4\u597d\u5730\u4eab\u53d7\u5496\u5561\u7684\u5473\u9053 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u575a\u679c\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u4efb\u4f55\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a28\u5143 \u5927\u676f\u4ef7\u683c\uff1a31\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a34\u5143 7.\u5496\u5561\u54c1\u540d\uff1a\u85b0\u8863\u8349\u62ff\u94c1 \u4e3b\u8981\u5356\u70b9\uff1a\u6dfb\u52a0\u4e86\u85b0\u8863\u8349\u9999\u6c14\uff0c\u53e3\u611f\u6e05\u65b0\u548c\u72ec\u7279\uff0c\u8ba9\u60a8\u5728\u4eab\u53d7\u5496\u5561\u4e4b\u4f59\uff0c\u8fd8\u80fd\u611f\u53d7\u5230\u81ea \u7136\u7684\u6c14\u606f \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u82b1\u8349\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u4e0b\u5348\u8336\u6216\u4f11\u95f2\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a30\u5143 \u5927\u676f\u4ef7\u683c\uff1a33\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a36\u5143 8.\u5496\u5561\u54c1\u540d\uff1a\u745e\u58eb\u7cd6\u6d46\u62ff\u94c1 \u4e3b\u8981\u5356\u70b9\uff1a\u9009\u7528\u4e86\u745e\u58eb\u8fdb\u53e3\u7684\u7cd6\u6d46\uff0c\u53e3\u611f\u751c\u7f8e\u6e05\u65b0\uff0c\u8ba9\u60a8\u5728\u4eab\u53d7\u5496\u5561\u7684\u540c\u65f6\u8fd8\u80fd\u611f\u53d7\u5230 \u7cd6\u6d46\u5e26\u6765\u7684\u7f8e\u5473 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u6e05\u65b0\u53e3\u611f\u7684\u4eba\u7fa4\uff0c\u5728\u4f11\u95f2\u6216\u4e0b\u5348\u8336\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a31\u5143 \u5927\u676f\u4ef7\u683c\uff1a34\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a37\u5143 9.\u5496\u5561\u54c1\u540d\uff1a\u51b0\u5496\u5561 \u4e3b\u8981\u5356\u70b9\uff1a\u7ecf\u5178\u996e\u54c1\uff0c\u5728\u500d\u513f\u723d\u7684\u590f\u65e5\uff0c\u9002\u5408\u559d\u6e05\u51c9\u7684\u51b0\u5496\u5561\uff0c\u6700\u597d\u642d\u914d\u8584\u8377\u53f6\uff0c\u53e3\u611f \u66f4\u4f73 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u559c\u6b22\u5496\u5561\u7684\u4eba\u7fa4\uff0c\u5728\u590f\u5b63\u6216\u4f11\u95f2\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a28\u5143 \u5927\u676f\u4ef7\u683c\uff1a31\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a34\u5143 10.\u5496\u5561\u54c1\u540d\uff1a\u53cc\u500d\u7279\u6d53\u5496\u5561", "doc_id": "5d6284ed-36c0-4a96-bdfb-783fcea19c35", "embedding": null, "doc_hash": "d18c8eff53d088c49deae1dac8a3421f28a4a288c61bbe4370a45db684428c82", "extra_info": {"page_label": "2", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 0, "end": 467, "_node_type": "1"}, "relationships": {"1": "2b996509-1fd2-4b54-96e2-0262d80f8094", "3": "7fd1a435-4c0d-46f2-ae68-5da48bcdfb57"}}, "__type__": "1"}, "7fd1a435-4c0d-46f2-ae68-5da48bcdfb57": {"__data__": {"text": "\u4e3b\u8981\u5356\u70b9\uff1a\u6d53\u7f29\u5496\u5561\u52a0\u500d\uff0c\u8ba9\u60a8\u5728\u5496\u5561\u4e2d\u611f\u53d7\u5230\u6d53\u90c1\u7684\u5473\u9053\uff0c\u9002\u5408\u9700\u8981\u63d0\u795e\u9192\u8111\u7684\u4eba\u7fa4 \u9002\u7528\u4eba\u7fa4\u548c\u573a\u666f\uff1a\u9700\u8981\u63d0\u795e\u9192\u8111\u7684\u4eba\u7fa4\uff0c\u5728\u5de5\u4f5c\u6216\u5b66\u4e60\u573a\u5408\u996e\u7528 \u4e2d\u676f\u4ef7\u683c\uff1a27\u5143 \u5927\u676f\u4ef7\u683c\uff1a30\u5143 \u8d85\u5927\u676f\u4ef7\u683c\uff1a33\u5143 \u4f5c\u4e3a\u4e00\u540d\u661f\u5df4\u514b\u7684\u5496\u5561\u5e08\uff0c\u6211\u5f88\u9ad8\u5174\u4e3a\u60a8\u4ecb\u7ecd\u6211\u4eec\u7684\u5496\u5561\u54c1\u79cd\u548c\u4ef7\u683c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u5496 \u5561\u54c1\u79cd\u548c\u76f8\u5e94\u7684\u5b9a\u4ef7\uff1a \u7f8e\u5f0f\u5496\u5561\uff08Americano\uff09\uff1a", "doc_id": "7fd1a435-4c0d-46f2-ae68-5da48bcdfb57", "embedding": null, "doc_hash": "7b85936163d3b360d1473bfe863a2b13ad1917536e3d6437d994dbfeccfb0fa3", "extra_info": {"page_label": "2", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 468, "end": 632, "_node_type": "1"}, "relationships": {"1": "2b996509-1fd2-4b54-96e2-0262d80f8094", "2": "5d6284ed-36c0-4a96-bdfb-783fcea19c35"}}, "__type__": "1"}, "b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39": {"__data__": {"text": "\u4ef7\u683c\u8303\u56f4\uff1a3.5\u7f8e\u5143-4.5\u7f8e\u5143 \u7b80\u4ecb\uff1a\u7f8e\u5f0f\u5496\u5561\u662f\u4e00\u79cd\u7ecf\u5178\u7684\u5496\u5561\uff0c\u7531\u4e00\u4efd\u6d53\u7f29\u5496\u5561\u548c\u70ed\u6c34\u6df7\u5408\u800c\u6210\u3002\u5b83\u5177\u6709\u6d53\u90c1\u7684\u5496\u5561\u9999 \u6c14\u548c\u5e73\u8861\u7684\u53e3\u5473\uff0c\u9002\u5408\u559c\u6b22\u7eaf\u7cb9\u5496\u5561\u98ce\u5473\u7684\u987e\u5ba2\u3002 \u62ff\u94c1\uff08Latte\uff09\uff1a \u4ef7\u683c\u8303\u56f4\uff1a4.5\u7f8e\u5143-5.5\u7f8e\u5143 \u7b80\u4ecb\uff1a\u62ff\u94c1\u662f\u4e00\u79cd\u7531\u6d53\u7f29\u5496\u5561\u3001\u84b8\u6c7d\u725b\u5976\u548c\u4e00\u5c42\u7ec6\u817b\u7684\u5976\u6ce1\u7ec4\u6210\u7684\u5496\u5561\u996e\u54c1\u3002\u5b83\u5177\u6709\u4e30\u5bcc\u7684 \u725b\u5976\u5473\u548c\u987a\u6ed1\u7684\u53e3\u611f\uff0c\u5e38\u5e38\u642d\u914d\u827a\u672f\u6027\u7684\u5976\u6ce1\u56fe\u6848\u3002 \u5361\u5e03\u5947\u8bfa\uff08Cappuccino\uff09\uff1a \u4ef7\u683c\u8303\u56f4\uff1a4.5\u7f8e\u5143-5.5\u7f8e\u5143 \u7b80\u4ecb\uff1a\u5361\u5e03\u5947\u8bfa\u662f\u4e00\u79cd\u7531\u7b49\u4efd\u7684\u6d53\u7f29\u5496\u5561\u3001\u84b8\u6c7d\u725b\u5976\u548c\u5976\u6ce1\u6784\u6210\u7684\u5496\u5561\u996e\u54c1\u3002\u5b83\u7684\u53e3\u611f\u4e30\u6ee1\uff0c \u5976\u6ce1\u548c\u5496\u5561\u7684\u5c42\u6b21\u611f\u4f7f\u5176\u6210\u4e3a\u7ecf\u5178\u9009\u62e9\u3002 \u51b0\u62ff\u94c1\uff08IcedLatte\uff09\uff1a \u4ef7\u683c\u8303\u56f4\uff1a4.5\u7f8e\u5143-5.5\u7f8e\u5143 \u7b80\u4ecb\uff1a\u51b0\u62ff\u94c1\u662f\u4e00\u79cd\u51b7\u996e\uff0c\u7531\u6d53\u7f29\u5496\u5561\u3001\u51b0\u5757\u548c\u725b\u5976\u6df7\u5408\u800c\u6210\u3002\u5b83\u5e26\u6709\u6e05\u51c9\u7684\u53e3\u611f\u548c\u67d4\u548c\u7684 \u5496\u5561\u9999\u6c14\uff0c\u662f\u590f\u5b63\u708e\u70ed\u5929\u6c14\u4e2d\u7684\u53d7\u6b22\u8fce\u9009\u62e9\u3002 \u7126\u7cd6\u739b\u5947\u6735\uff08CaramelMacchiato\uff09\uff1a \u4ef7\u683c\u8303\u56f4\uff1a5\u7f8e\u5143-6\u7f8e\u5143 \u7b80\u4ecb\uff1a\u7126\u7cd6\u739b\u5947\u6735\u662f\u4e00\u79cd\u751c\u7f8e\u7684\u5496\u5561\u996e\u54c1\uff0c\u7531\u6d53\u7f29\u5496\u5561\u3001\u84b8\u6c7d\u725b\u5976\u3001\u9999\u8349\u7cd6\u6d46\u548c\u7126\u7cd6\u9171\u6784\u6210\u3002 \u5b83\u5177\u6709\u6d53\u90c1\u7684\u7126\u7cd6\u9999\u6c14\u548c\u5976\u6cb9\u822c\u7684\u53e3\u611f\u3002 \u8bf7\u6ce8\u610f\uff0c\u4ee5\u4e0a\u5b9a\u4ef7\u4ec5\u4e3a\u53c2\u8003\uff0c\u5b9e\u9645\u5b9a\u4ef7\u53ef\u80fd\u56e0\u5730\u7406\u4f4d\u7f6e\u3001\u5b63\u8282\u4fc3\u9500\u548c\u5176\u4ed6\u56e0\u7d20\u800c\u6709\u6240\u53d8\u5316\u3002", "doc_id": "b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39", "embedding": null, "doc_hash": "28c41849ae254075fdd46a9ebdbb2e9e12400aec658c21dfc248fb43a19afeda", "extra_info": {"page_label": "3", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 0, "end": 504, "_node_type": "1"}, "relationships": {"1": "9e7cf718-f627-4de4-8df8-e7586b086398", "3": "896c532e-e190-4afd-8cd5-93d826d7deef"}}, "__type__": "1"}, "896c532e-e190-4afd-8cd5-93d826d7deef": {"__data__": {"text": "\u6b64\u5916\uff0c\u661f\u5df4\u514b\u8fd8\u63d0\u4f9b\u5176\u4ed6\u7279\u8272\u5496\u5561\u996e\u54c1\u548c\u8c03\u5473\u54c1\u9009\u62e9\uff0c\u60a8\u53ef\u4ee5\u5728\u6211\u4eec\u7684\u5e97\u94fa\u4e2d\u8be6\u7ec6\u4e86\u89e3\u5e76\u9009 \u62e9\u9002\u5408\u60a8\u53e3\u5473\u7684\u5496\u5561\u3002 Giventhecontextinformationandnotpriorknowledge,answerthequestion:\u6211\u6709\u70b9\u4e73\u7cd6\u4e0d\u8010\uff0c \u4eca\u5929\u5929\u6c14\u6709\u70b9\u70ed\uff0c\u8bf7\u4f5c\u4e3a\u661f\u5df4\u514b\u7684\u5496\u5561\u5e08\u5e2e\u6211\u63a8\u8350\u4e00\u6b3e\u661f\u5df4\u514b\u7684\u5496\u5561\uff0c\u4ef7\u683c\u8bf7\u4e0d\u8981\u8d85\u8fc735 \u5757 \u7c89\u7c89\u751f\u5496\u662f\u661f\u5df4\u514b\u7684\u65b0\u54c1\uff0c\u878d\u5165\u4e86\u8403\u53d6\u81ea\u672a\u7ecf\u70d8\u7119\u7684\u963f\u62c9\u6bd4\u5361\u751f\u8c46\u7684\u5496\u5561\u539f\u6db2\uff08\u8fd9\u662f\u4e00\u6b3e\u8f7b \u5496\u5561\u56e0\u996e\u6599\uff0c\u5b8c\u5168\u559d\u4e0d\u51fa\u5496\u5561\u5473\uff0c\u7528\u7684\u662f\u71d5\u9ea6\u5976\uff0c\u4e73\u7cd6\u4e0d\u8010\u8005\u4e5f\u80fd\u559d\uff09\u3002\u7c89\u7c89\u751f\u5496\u662f\u5c06\u679c\u6c41 \u548c\u679c\u5e72\u878d\u5408\uff0c\u7c89\u7c89\u751f\u5496\u7684\u6930\u9999\u4e0e\u5496\u9999\u5e76\u5b58\uff0c\u60ca\u8273\u4f60\u7684\u5473\u857e\uff0c\u4e3a\u708e\u708e\u590f\u65e5\u5e26\u6765\u4e00\u70b9\u820c\u5c16\u4e0a\u7684\u51b0 \u723d!\u7c89\u7c89\u751f\u5496\u4ef7\u683c\u662f\u4e2d\u676f34\u5143\u5927\u676f37\u5143\u8d85\u5927\u676f40\u5143\u3002 \u4f5c\u4e3a\u661f\u5df4\u514b\u7684\u5496\u5561\u5e08\uff0c\u6839\u636e\u60a8\u7684\u8981\u6c42\uff0c\u6211\u63a8\u8350\u661f\u5df4\u514b\u7684\u65b0\u54c1\u2014\u2014\u7c89\u7c89\u751f\u5496\u8fd9\u6b3e\u5496\u5561\u996e\u6599\u3002\u7c89 \u7c89\u751f\u5496\u878d\u5165\u4e86\u8403\u53d6\u81ea\u672a\u7ecf\u70d8\u7119\u7684\u963f\u62c9\u6bd4\u5361\u751f\u8c46\u7684\u5496\u5561\u539f\u6db2\uff0c\u7528\u7684\u662f\u71d5\u9ea6\u5976\uff0c\u4e73\u7cd6\u4e0d\u8010\u8005\u4e5f\u80fd \u559d\u3002\u5b83\u662f\u4e00\u6b3e\u8f7b\u5496\u5561\u56e0\u996e\u6599\uff0c\u5b8c\u5168\u559d\u4e0d\u51fa\u5496\u5561\u5473\uff0c\u975e\u5e38\u9002\u5408\u4eca\u5929\u7684\u5929\u6c14\u3002\u53e6\u5916\uff0c\u7c89\u7c89\u751f\u5496\u6df7 \u5408\u4e86\u679c\u6c41\u548c\u679c\u5e72\uff0c\u6930\u9999\u548c\u5496\u5561\u7684\u82b3\u9999\u5171\u5b58\uff0c\u80fd\u591f\u60ca\u8273\u60a8\u7684\u5473\u857e\uff0c\u4e3a\u708e\u708e\u590f\u65e5\u5e26\u6765\u4e00\u70b9\u820c\u5c16\u4e0a", "doc_id": "896c532e-e190-4afd-8cd5-93d826d7deef", "embedding": null, "doc_hash": "70584d5168409fb33f388d6bd3d84d1e586d3b59ef38a2eafb4164690c692fa9", "extra_info": {"page_label": "3", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 505, "end": 987, "_node_type": "1"}, "relationships": {"1": "9e7cf718-f627-4de4-8df8-e7586b086398", "2": "b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39"}}, "__type__": "1"}, "8338d8a7-544f-4b33-bf3e-c78f057dc679": {"__data__": {"text": "\u7684\u51b0\u723d!\u4ef7\u683c\u65b9\u9762\uff0c\u4e2d\u676f\u662f34\u5143\uff0c\u7b26\u5408\u60a8\u7684\u8981\u6c42\u3002\u5e0c\u671b\u60a8\u4f1a\u559c\u6b22\u8fd9\u6b3e\u5496\u5561\u3002", "doc_id": "8338d8a7-544f-4b33-bf3e-c78f057dc679", "embedding": null, "doc_hash": "a3e842b09f05dccd3bc3524c0f0d6760ec3ad6ab606badbde65be6a29d2128ba", "extra_info": {"page_label": "4", "file_name": "coffee_learn.pdf"}, "node_info": {"start": 0, "end": 34, "_node_type": "1"}, "relationships": {"1": "aa8ce8f2-c971-4a8a-aac3-0131c9ac9470"}}, "__type__": "1"}}, "docstore/ref_doc_info": {"bc683a46-28f1-431b-ac3b-aa12c6ddd43d": {"doc_ids": ["0505f5a7-29ac-4744-a877-79f2befc7c56", "df50d309-1f12-4324-9231-c9d19f85e943"], "extra_info": {"page_label": "1", "file_name": "coffee_learn.pdf"}}, "2b996509-1fd2-4b54-96e2-0262d80f8094": {"doc_ids": ["5d6284ed-36c0-4a96-bdfb-783fcea19c35", "7fd1a435-4c0d-46f2-ae68-5da48bcdfb57"], "extra_info": {"page_label": "2", "file_name": "coffee_learn.pdf"}}, "9e7cf718-f627-4de4-8df8-e7586b086398": {"doc_ids": ["b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39", "896c532e-e190-4afd-8cd5-93d826d7deef"], "extra_info": {"page_label": "3", "file_name": "coffee_learn.pdf"}}, "aa8ce8f2-c971-4a8a-aac3-0131c9ac9470": {"doc_ids": ["8338d8a7-544f-4b33-bf3e-c78f057dc679"], "extra_info": {"page_label": "4", "file_name": "coffee_learn.pdf"}}}}
|
|
|
|
dataset/graph_store.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"graph_dict": {}}
|
|
|
|
dataset/index_store.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"index_store/data": {"15ea48f9-f1e0-4820-8d5a-b89386c66700": {"__type__": "vector_store", "__data__": "{\"index_id\": \"15ea48f9-f1e0-4820-8d5a-b89386c66700\", \"summary\": null, \"nodes_dict\": {\"0505f5a7-29ac-4744-a877-79f2befc7c56\": \"0505f5a7-29ac-4744-a877-79f2befc7c56\", \"df50d309-1f12-4324-9231-c9d19f85e943\": \"df50d309-1f12-4324-9231-c9d19f85e943\", \"5d6284ed-36c0-4a96-bdfb-783fcea19c35\": \"5d6284ed-36c0-4a96-bdfb-783fcea19c35\", \"7fd1a435-4c0d-46f2-ae68-5da48bcdfb57\": \"7fd1a435-4c0d-46f2-ae68-5da48bcdfb57\", \"b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39\": \"b5bd9ddf-5bbf-48b5-9740-98d39ccb6a39\", \"896c532e-e190-4afd-8cd5-93d826d7deef\": \"896c532e-e190-4afd-8cd5-93d826d7deef\", \"8338d8a7-544f-4b33-bf3e-c78f057dc679\": \"8338d8a7-544f-4b33-bf3e-c78f057dc679\"}, \"doc_id_dict\": {}, \"embeddings_dict\": {}}"}}}
|
|
|
|
dataset/vector_store.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
docs.pkl
DELETED
Binary file (30.4 kB)
|
|
enum_check.py
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
import enum
|
2 |
-
from abc import ABC, abstractmethod
|
3 |
-
|
4 |
-
class Iterable(ABC):
|
5 |
-
@abstractmethod
|
6 |
-
def has_next(self) -> bool:
|
7 |
-
pass
|
8 |
-
|
9 |
-
@abstractmethod
|
10 |
-
def next(self):
|
11 |
-
pass
|
12 |
-
class FinalStateMachine(Iterable, ABC):
|
13 |
-
@abstractmethod
|
14 |
-
def get_state(self) -> str:
|
15 |
-
pass
|
16 |
-
|
17 |
-
@classmethod
|
18 |
-
def entry_point(cls):
|
19 |
-
return STAGE_ONE()
|
20 |
-
|
21 |
-
class STAGE_THREE(FinalStateMachine):
|
22 |
-
def get_state(self):
|
23 |
-
return "stage-three"
|
24 |
-
|
25 |
-
def next(self):
|
26 |
-
return None
|
27 |
-
|
28 |
-
def has_next(self) -> bool:
|
29 |
-
return False
|
30 |
-
|
31 |
-
class STAGE_TWO(FinalStateMachine):
|
32 |
-
def get_state(self):
|
33 |
-
return "stage-two"
|
34 |
-
|
35 |
-
def next(self):
|
36 |
-
return STAGE_THREE()
|
37 |
-
|
38 |
-
def has_next(self):
|
39 |
-
return True
|
40 |
-
|
41 |
-
class STAGE_ONE(FinalStateMachine):
|
42 |
-
def get_state(self):
|
43 |
-
return "stage-one"
|
44 |
-
|
45 |
-
def next(self):
|
46 |
-
return STAGE_TWO()
|
47 |
-
|
48 |
-
def has_next(self):
|
49 |
-
return True
|
50 |
-
|
51 |
-
if __name__ == '__main__':
|
52 |
-
s = FinalStateMachine.entry_point()
|
53 |
-
print(s.get_state())
|
54 |
-
while s.has_next():
|
55 |
-
s = s.next()
|
56 |
-
print(s.get_state())
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{data_initializer → langchain}/__init__.py
RENAMED
File without changes
|
langchain/manager.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from abc import abstractmethod, ABC
|
2 |
+
|
3 |
+
from langchain.embeddings.base import Embeddings as LCEmbeddings
|
4 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
5 |
+
from langchain.llms import AzureOpenAI
|
6 |
+
from langchain.base_language import BaseLanguageModel
|
7 |
+
|
8 |
+
from core.lifecycle import Lifecycle
|
9 |
+
|
10 |
+
|
11 |
+
class LangChainManager(Lifecycle, ABC):
|
12 |
+
def __init__(self):
|
13 |
+
super().__init__()
|
14 |
+
|
15 |
+
@abstractmethod
|
16 |
+
def get_embedding(self) -> LCEmbeddings:
|
17 |
+
pass
|
18 |
+
|
19 |
+
@abstractmethod
|
20 |
+
def get_llm(self) -> BaseLanguageModel:
|
21 |
+
pass
|
22 |
+
|
23 |
+
|
24 |
+
class LangChainAzureManager(LangChainManager):
|
25 |
+
|
26 |
+
def __init__(self):
|
27 |
+
super().__init__()
|
28 |
+
|
29 |
+
# Override
|
30 |
+
def get_embedding(self) -> LCEmbeddings:
|
31 |
+
return OpenAIEmbeddings(chunk_size=1)
|
32 |
+
|
33 |
+
# Override
|
34 |
+
def get_llm(self) -> BaseLanguageModel:
|
35 |
+
return AzureOpenAI(
|
36 |
+
engine="text-davinci-003",
|
37 |
+
model_name="text-davinci-003",
|
38 |
+
)
|
llama/__init__.py
ADDED
File without changes
|
llama/context.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from llama_index import ServiceContext, LLMPredictor, LangchainEmbedding
|
2 |
+
|
3 |
+
from core.lifecycle import Lifecycle
|
4 |
+
from langchain.manager import LangChainManager
|
5 |
+
|
6 |
+
|
7 |
+
class ServiceContextManager(Lifecycle):
|
8 |
+
|
9 |
+
def __init__(self, manager: [LangChainManager]):
|
10 |
+
super().__init__()
|
11 |
+
self.manager = manager
|
12 |
+
self.service_context = None
|
13 |
+
|
14 |
+
def get_service_context(self) -> ServiceContext:
|
15 |
+
if self.lifecycle_state.is_started():
|
16 |
+
raise Exception("incorrect lifecycle state: {}".format(self.get_lifecycle_state()))
|
17 |
+
return self.service_context
|
18 |
+
|
19 |
+
def do_init(self):
|
20 |
+
# define embedding
|
21 |
+
embedding = LangchainEmbedding(self.manager.get_embedding())
|
22 |
+
# define LLM
|
23 |
+
llm_predictor = LLMPredictor(llm=self.manager.get_llm())
|
24 |
+
# configure service context
|
25 |
+
self.service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, embed_model=embedding)
|
26 |
+
|
27 |
+
def do_start(self):
|
28 |
+
pass
|
29 |
+
|
30 |
+
def do_stop(self):
|
31 |
+
pass
|
32 |
+
|
33 |
+
def do_dispose(self):
|
34 |
+
pass
|
35 |
+
|
36 |
+
|
37 |
+
class StorageContextManager(Lifecycle):
|
38 |
+
|
39 |
+
def __init__(self, dataset_path: [str] = './dataset'):
|
40 |
+
super().__init__()
|
41 |
+
self.dataset_path = dataset_path
|
42 |
+
|
43 |
+
def do_init(self):
|
44 |
+
pass
|
45 |
+
|
46 |
+
def do_start(self):
|
47 |
+
pass
|
48 |
+
|
49 |
+
def do_stop(self):
|
50 |
+
pass
|
51 |
+
|
52 |
+
def do_dispose(self):
|
53 |
+
pass
|
llama/data_loader.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import pickle
|
3 |
+
from abc import abstractmethod, ABC
|
4 |
+
from typing import Optional, Sequence, List
|
5 |
+
|
6 |
+
from llama_hub.github_repo import GithubRepositoryReader, GithubClient
|
7 |
+
from llama_index import download_loader
|
8 |
+
from llama_index.readers.schema.base import Document
|
9 |
+
|
10 |
+
from core.lifecycle import Lifecycle
|
11 |
+
|
12 |
+
|
13 |
+
class WikiLoader(ABC):
|
14 |
+
@abstractmethod
|
15 |
+
def load(self) -> List[Document]:
|
16 |
+
pass
|
17 |
+
|
18 |
+
|
19 |
+
class GithubLoader(WikiLoader, Lifecycle):
|
20 |
+
|
21 |
+
def __init__(self, github_owner: Optional[str] = None,
|
22 |
+
repo: Optional[str] = None,
|
23 |
+
dirs: Optional[Sequence[str]] = None):
|
24 |
+
super().__init__()
|
25 |
+
self.owner = github_owner if github_owner is not None else os.environ["GITHUB_OWNER"]
|
26 |
+
self.repo = repo if repo is not None else os.environ["GITHUB_REPO"]
|
27 |
+
self.dirs = dirs if dirs is not None else [".", "doc"]
|
28 |
+
|
29 |
+
def load(self) -> List[Document]:
|
30 |
+
download_loader("GithubRepositoryReader")
|
31 |
+
docs = None
|
32 |
+
if os.path.exists("docs/docs.pkl"):
|
33 |
+
with open("docs/docs.pkl", "rb") as f:
|
34 |
+
docs = pickle.load(f)
|
35 |
+
|
36 |
+
if docs is not None:
|
37 |
+
return docs
|
38 |
+
|
39 |
+
# otherwise, we download from github and save it locally
|
40 |
+
github_client = GithubClient(os.getenv("GITHUB_TOKEN"))
|
41 |
+
loader = GithubRepositoryReader(
|
42 |
+
github_client,
|
43 |
+
# owner="ctripcorp",
|
44 |
+
owner=self.owner,
|
45 |
+
# repo="x-pipe",
|
46 |
+
repo=self.repo,
|
47 |
+
filter_directories=(self.dirs, GithubRepositoryReader.FilterType.INCLUDE),
|
48 |
+
filter_file_extensions=([".md"], GithubRepositoryReader.FilterType.INCLUDE),
|
49 |
+
verbose=True,
|
50 |
+
concurrent_requests=10,
|
51 |
+
)
|
52 |
+
|
53 |
+
docs = loader.load_data(branch="master")
|
54 |
+
|
55 |
+
with open("docs/docs.pkl", "wb") as f:
|
56 |
+
pickle.dump(docs, f)
|
57 |
+
|
58 |
+
return docs
|
llama/index.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from core.lifecycle import Lifecycle
|
2 |
+
from llama.context import ServiceContextManager
|
3 |
+
|
4 |
+
|
5 |
+
class IndexManager(Lifecycle):
|
6 |
+
|
7 |
+
def __init__(self, context_manager: [ServiceContextManager]):
|
8 |
+
super().__init__()
|
9 |
+
self.index = None
|
10 |
+
self.context_manager = context_manager
|
11 |
+
|
12 |
+
def get_index(self):
|
13 |
+
if not self.lifecycle_state.is_started():
|
14 |
+
raise Exception("Lifecycle state is not correct")
|
15 |
+
return self.index
|
llama/vector_storage.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from core.lifecycle import Lifecycle
|
2 |
+
|
3 |
+
|
4 |
+
class VectorStorageManager(Lifecycle):
|
5 |
+
|
6 |
+
def __init__(self):
|
7 |
+
super().__init__()
|
8 |
+
|
9 |
+
def do_init(self):
|
10 |
+
pass
|
11 |
+
|
12 |
+
def do_start(self):
|
13 |
+
pass
|
14 |
+
|
15 |
+
def do_stop(self):
|
16 |
+
pass
|
17 |
+
|
18 |
+
def do_dispose(self):
|
19 |
+
pass
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
llama_index
|
2 |
llama_hub
|
3 |
-
|
|
|
1 |
llama_index
|
2 |
llama_hub
|
3 |
+
langchain
|