sinapsis-chatbots-base 0.1.7__tar.gz → 0.1.8__tar.gz

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.
Files changed (22) hide show
  1. {sinapsis_chatbots_base-0.1.7/src/sinapsis_chatbots_base.egg-info → sinapsis_chatbots_base-0.1.8}/PKG-INFO +1 -1
  2. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/pyproject.toml +1 -1
  3. sinapsis_chatbots_base-0.1.8/src/sinapsis_chatbots_base/helpers/llm_keys.py +53 -0
  4. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/helpers/tags.py +1 -0
  5. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/templates/llm_text_completion_base.py +7 -4
  6. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8/src/sinapsis_chatbots_base.egg-info}/PKG-INFO +1 -1
  7. sinapsis_chatbots_base-0.1.7/src/sinapsis_chatbots_base/helpers/llm_keys.py +0 -24
  8. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/LICENSE +0 -0
  9. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/README.md +0 -0
  10. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/setup.cfg +0 -0
  11. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/__init__.py +0 -0
  12. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/__init__.py +0 -0
  13. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/helpers/__init__.py +0 -0
  14. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/helpers/huggingface_access_keys.py +0 -0
  15. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/helpers/postprocess_text.py +0 -0
  16. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/templates/__init__.py +0 -0
  17. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/templates/query_contextualize.py +0 -0
  18. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base/templates/query_contextualize_from_file.py +0 -0
  19. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base.egg-info/SOURCES.txt +0 -0
  20. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base.egg-info/dependency_links.txt +0 -0
  21. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base.egg-info/requires.txt +0 -0
  22. {sinapsis_chatbots_base-0.1.7 → sinapsis_chatbots_base-0.1.8}/src/sinapsis_chatbots_base.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sinapsis-chatbots-base
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Package with base functionality for llm text creation
5
5
  Project-URL: Homepage, https://sinapsis.tech
6
6
  Project-URL: Documentation, https://docs.sinapsis.tech/docs
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sinapsis-chatbots-base"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = "Package with base functionality for llm text creation"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,53 @@
1
+ # -*- coding: utf-8 -*-
2
+ from typing import Literal
3
+
4
+ from pydantic.dataclasses import dataclass
5
+
6
+
7
+ @dataclass
8
+ class LLMChatKeys:
9
+ """
10
+ A class to hold constants for the keys used in chat interactions with an LLM (Large Language Model).
11
+
12
+ These keys represent the standard fields in a chat interaction, such as the role of the participant
13
+ and the content of the message. They are typically used when constructing input messages or
14
+ processing the output from an LLM.
15
+ """
16
+
17
+ role: Literal["role"] = "role"
18
+ content: Literal["content"] = "content"
19
+ choices: Literal["choices"] = "choices"
20
+ message: Literal["message"] = "message"
21
+ llm_responses: Literal["llm_responses"] = "llm_responses"
22
+ system_value: Literal["system"] = "system"
23
+ user_value: Literal["user"] = "user"
24
+ assistant_value: Literal["assistant"] = "assistant"
25
+
26
+
27
+ @dataclass
28
+ class MCPKeys:
29
+ tools: Literal["tools"] = "tools"
30
+ tool_use: Literal["tool_use"] = "tool_use"
31
+ tool_results: Literal["tool_results"] = "tool_results"
32
+ tool_name: Literal["tool_name"] = "tool_name"
33
+ args: Literal["args"] = "args"
34
+ tool_use_id: Literal["tool_use_id"] = "tool_use_id"
35
+ partial_response: Literal["partial_response"] = "partial_response"
36
+ tool_calls: Literal["tool_calls"] = "tool_calls"
37
+ last_container: Literal["_last_container"] = "_last_container"
38
+ input_schema: Literal["input_schema"] = "input_schema"
39
+ properties: Literal["properties"] = "properties"
40
+ required: Literal["required"] = "required"
41
+ partial_query: Literal["partial_query"] = "partial_query"
42
+ tool_type: Literal["type"] = "type"
43
+ function: Literal["function"] = "function"
44
+ name: Literal["name"] = "name"
45
+ description: Literal["description"] = "description"
46
+ parameters: Literal["parameters"] = "parameters"
47
+ is_error: Literal["is_error"] = "is_error"
48
+ text: Literal["text"] = "text"
49
+ finish_reason: Literal["finish_reason"] = "finish_reason"
50
+ tool_id: Literal["id"] = "id"
51
+ arguments: Literal["arguments"] = "arguments"
52
+ tool_call_id: Literal["tool_call_id"] = "tool_call_id"
53
+ tool: Literal["tool"] = "tool"
@@ -26,3 +26,4 @@ class Tags(Enum):
26
26
  QUERY = "query"
27
27
  QUERY_CONTEXTUALIZATION = "query_contextualization"
28
28
  VECTORS = "vectors"
29
+ MCP = "mcp"
@@ -139,7 +139,8 @@ class LLMTextCompletionBase(Template):
139
139
  Subclasses may override this method to implement model-specific reset behaviors
140
140
  if needed.
141
141
  """
142
- self.llm.reset()
142
+ if self.llm:
143
+ self.llm.reset()
143
144
 
144
145
  def infer(self, text: str | list) -> str | None:
145
146
  """Gets a response from the model, handling any errors or issues by resetting the model state if necessary.
@@ -155,7 +156,9 @@ class LLMTextCompletionBase(Template):
155
156
  return self.get_response(text)
156
157
  except ValueError:
157
158
  self.reset_llm_state()
158
- return self.get_response(text)
159
+ if self.llm:
160
+ return self.get_response(text)
161
+ return None
159
162
 
160
163
  @staticmethod
161
164
  def generate_dict_msg(role: str, msg_content: str | list | None) -> dict:
@@ -242,8 +245,8 @@ class LLMTextCompletionBase(Template):
242
245
  full_context.append(message)
243
246
  response = self.infer(full_context)
244
247
  self.logger.debug("End of interaction.")
245
-
246
- responses.append(TextPacket(source=session_id, content=response, id=user_id))
248
+ if response:
249
+ responses.append(TextPacket(source=session_id, content=response, id=user_id))
247
250
 
248
251
  container.texts.extend(responses)
249
252
  return container
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sinapsis-chatbots-base
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Package with base functionality for llm text creation
5
5
  Project-URL: Homepage, https://sinapsis.tech
6
6
  Project-URL: Documentation, https://docs.sinapsis.tech/docs
@@ -1,24 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from typing import Literal
3
-
4
- from pydantic.dataclasses import dataclass
5
-
6
-
7
- @dataclass
8
- class LLMChatKeys:
9
- """
10
- A class to hold constants for the keys used in chat interactions with an LLM (Large Language Model).
11
-
12
- These keys represent the standard fields in a chat interaction, such as the role of the participant
13
- and the content of the message. They are typically used when constructing input messages or
14
- processing the output from an LLM.
15
- """
16
-
17
- role: Literal["role"] = "role"
18
- content: Literal["content"] = "content"
19
- choices: Literal["choices"] = "choices"
20
- message: Literal["message"] = "message"
21
- llm_responses: Literal["llm_responses"] = "llm_responses"
22
- system_value: Literal["system"] = "system"
23
- user_value: Literal["user"] = "user"
24
- assistant_value: Literal["assistant"] = "assistant"