reme-ai 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

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.
reme_ai/__init__.py CHANGED
@@ -3,4 +3,4 @@ from reme_ai import retrieve
3
3
  from reme_ai import summary
4
4
  from reme_ai import vector_store
5
5
 
6
- __version__ = "0.1.3"
6
+ __version__ = "0.1.4"
@@ -123,6 +123,22 @@ flow:
123
123
  description: "user query"
124
124
  required: true
125
125
 
126
+ op:
127
+ # retriever ops
128
+ rerank_memory_op:
129
+ backend: rerank_memory_op
130
+ llm: default
131
+ params:
132
+ enable_llm_rerank: true
133
+ enable_score_filter: false
134
+ top_k: 5
135
+
136
+ rewrite_memory_op:
137
+ backend: rewrite_memory_op
138
+ llm: default
139
+ params:
140
+ enable_llm_rewrite: true
141
+
126
142
  llm:
127
143
  default:
128
144
  backend: openai_compatible
@@ -5,8 +5,6 @@
5
5
 
6
6
  WORKFLOW_NAME = "workflow_name"
7
7
 
8
- MEMORYSCOPE_CONTEXT = "memoryscope_context"
9
-
10
8
  RESULT = "result"
11
9
 
12
10
  MEMORIES = "memories"
@@ -1,4 +1,4 @@
1
- from memoryscope.enumeration.language_enum import LanguageEnum
1
+ from ..enumeration.language_enum import LanguageEnum
2
2
 
3
3
  # This dictionary maps languages to lists of words related to datetime expressions.
4
4
  # It aids in recognizing and processing datetime mentions in text, enhancing the system's ability to understand
@@ -0,0 +1,14 @@
1
+ from enum import Enum
2
+
3
+
4
+ class LanguageEnum(str, Enum):
5
+ """
6
+ An enumeration representing supported languages.
7
+
8
+ Members:
9
+ - CN: Represents the Chinese language.
10
+ - EN: Represents the English language.
11
+ """
12
+ CN = "cn"
13
+
14
+ EN = "en"
@@ -2,7 +2,6 @@ from .comparative_extraction_op import ComparativeExtractionOp
2
2
  from .failure_extraction_op import FailureExtractionOp
3
3
  from .memory_deduplication_op import MemoryDeduplicationOp
4
4
  from .memory_validation_op import MemoryValidationOp
5
- from .pdf_preprocess_op_wrapper import PDFPreprocessOp
6
5
  from .simple_comparative_summary_op import SimpleComparativeSummaryOp
7
6
  from .simple_summary_op import SimpleSummaryOp
8
7
  from .success_extraction_op import SuccessExtractionOp
@@ -1,4 +1,3 @@
1
- import json
2
1
  from typing import List, Dict
3
2
 
4
3
  from flowllm import C, BaseOp
@@ -14,15 +13,7 @@ class TrajectoryPreprocessOp(BaseOp):
14
13
  def execute(self):
15
14
  """Preprocess trajectories: validate and classify"""
16
15
  trajectories: list = self.context.get("trajectories", [])
17
- # trajectories: List[Trajectory] = [Trajectory(**x) if isinstance(x, dict) else x for x in trajectories]
18
- new_trajectories: List[Trajectory] = []
19
- for x in trajectories:
20
- if isinstance(x, dict):
21
- x["messages"] = self._modify_tool_calls(x["messages"])
22
- new_trajectories.append(Trajectory(**x))
23
- else:
24
- new_trajectories.append(x)
25
- trajectories = new_trajectories
16
+ trajectories: List[Trajectory] = [Trajectory(**x) if isinstance(x, dict) else x for x in trajectories]
26
17
 
27
18
  # Classify trajectories
28
19
  classified = self._classify_trajectories(trajectories)
@@ -53,24 +44,4 @@ class TrajectoryPreprocessOp(BaseOp):
53
44
  'success': success_trajectories,
54
45
  'failure': failure_trajectories,
55
46
  'all': trajectories
56
- }
57
-
58
- def _modify_tool_calls(self, messages: List[Dict]) -> List[Dict]:
59
- new_messages = []
60
-
61
- for msg in messages:
62
- if 'tool_calls' in msg:
63
- processed_tool_calls = []
64
- for tool_call in msg['tool_calls']:
65
- tool_type = tool_call.get("type", "function")
66
- nested_data = tool_call.get(tool_type, {})
67
- tool_call.update({
68
- "arguments": json.loads(nested_data.get("arguments", "")),
69
- "name": nested_data.get("name", "")
70
- })
71
- tool_call.pop(tool_type)
72
- processed_tool_calls.append(tool_call)
73
- msg['tool_calls'] = processed_tool_calls
74
- new_messages.append(msg)
75
-
76
- return new_messages
47
+ }
@@ -2,8 +2,8 @@ import datetime
2
2
  import re
3
3
  from typing import List
4
4
 
5
+ from reme_ai.constants.language_constants import LanguageEnum
5
6
  from reme_ai.constants.language_constants import WEEKDAYS, DATATIME_WORD_LIST, MONTH_DICT
6
- from reme_ai.enumeration.language_constants import LanguageEnum
7
7
 
8
8
 
9
9
  class DatetimeHandler(object):