ai-parrot 0.3.5__cp311-cp311-manylinux_2_28_x86_64.whl → 0.3.6__cp311-cp311-manylinux_2_28_x86_64.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.

Potentially problematic release.


This version of ai-parrot might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-parrot
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Live Chatbots based on Langchain chatbots and Agents Integrated into Navigator Framework or used into aiohttp applications.
5
5
  Home-page: https://github.com/phenobarbital/ai-parrot
6
6
  Author: Jesus Lara
@@ -4,7 +4,7 @@ parrot/exceptions.cpython-311-x86_64-linux-gnu.so,sha256=VNyBh3uLxGQgB0l1bkWjQDq
4
4
  parrot/manager.py,sha256=NhzXoWxSgtoWHpmYP8cV2Ujq_SlvCbQYQBaohAeL2TM,5935
5
5
  parrot/models.py,sha256=RsVQCqhSXBKRPcu-BCga9Y1wyvENFXDCuq3_ObIKvAo,13452
6
6
  parrot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- parrot/version.py,sha256=RknhCGT72EptwSfSvr4rE9_fulip0_-gBlla3iuIIi4,373
7
+ parrot/version.py,sha256=x5KFeKUhuf0IyJRSN3fSKlwqSDRNfHYDoFae9slFeKc,373
8
8
  parrot/chatbots/__init__.py,sha256=ypskCnME0xUv6psBEGCEyXCrD0J0ULHSllpVmSxqb4A,200
9
9
  parrot/chatbots/abstract.py,sha256=CmDn3k4r9uKImOZRN4L9zxLbCdC-1MPUAorDlfZT-kA,26421
10
10
  parrot/chatbots/asktroc.py,sha256=gyWzyvpAnmXwXd-3DEKoIJtAxt6NnP5mUZdZbkFky8s,604
@@ -68,7 +68,7 @@ parrot/loaders/repo.py,sha256=vBqBAnwU6p3_DCvI9DVhi1Bs8iCDYHwFGp0P9zvGRyw,3737
68
68
  parrot/loaders/rtd.py,sha256=oKOC9Qn3iwulYx5BEvXy4_kusKRsy5RLYNHS-e5p-1k,1988
69
69
  parrot/loaders/txt.py,sha256=AeGroWffFT--7TYlTSTr5Av5zAr8YIp1fxt8r5qdi-A,2802
70
70
  parrot/loaders/video.py,sha256=pl5Ho69bp5vrWMqg5tLbsnHUus1LByTDoL6NPk57Ays,2929
71
- parrot/loaders/videolocal.py,sha256=VBjtDIZ7CxkmgISXNr2Nc68MHa9-57qQr0uSxLIsAOU,4326
71
+ parrot/loaders/videolocal.py,sha256=o1upjpsMHp1NV4ZQVRc2DS8nKyJI1l0x9p3PjJUr3fU,5018
72
72
  parrot/loaders/vimeo.py,sha256=zOvOOIiaZr_bRswJFI7uIMKISgALOxcSim9ZRUFY1Fc,4114
73
73
  parrot/loaders/web.py,sha256=3x06JNpfTGFtvSBPAEBVoVdZkpVXePcJeMtj61B2xJk,8867
74
74
  parrot/loaders/web_base.py,sha256=5SjQddT0Vhne8C9s30iU3Ex_9O1PJ8kyDmy8EdhGBo0,4380
@@ -103,8 +103,8 @@ resources/users/handlers.py,sha256=BGzqBvPY_OaIF_nONWX4b_B5OyyBrdGuSihIsdlFwjk,2
103
103
  resources/users/models.py,sha256=glk7Emv7QCi6i32xRFDrGc8UwK23_LPg0XUOJoHnwRU,6799
104
104
  settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
105
105
  settings/settings.py,sha256=9ueEvyLNurUX-AaIeRPV8GKX1c4YjDLbksUAeqEq6Ck,1854
106
- ai_parrot-0.3.5.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
107
- ai_parrot-0.3.5.dist-info/METADATA,sha256=G19tFikgbnhRqltqs2_OulmbuqdrA4Gwp2wW_dx5URk,9721
108
- ai_parrot-0.3.5.dist-info/WHEEL,sha256=UQ-0qXN3LQUffjrV43_e_ZXj2pgORBqTmXipnkj0E8I,113
109
- ai_parrot-0.3.5.dist-info/top_level.txt,sha256=qHoO4BhYDfeTkyKnciZSQtn5FSLN3Q-P5xCTkyvbuxg,26
110
- ai_parrot-0.3.5.dist-info/RECORD,,
106
+ ai_parrot-0.3.6.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
107
+ ai_parrot-0.3.6.dist-info/METADATA,sha256=UukaICPH6ngFNm_DU3TmP2E89_BpgchSP0oPLxypwso,9721
108
+ ai_parrot-0.3.6.dist-info/WHEEL,sha256=UQ-0qXN3LQUffjrV43_e_ZXj2pgORBqTmXipnkj0E8I,113
109
+ ai_parrot-0.3.6.dist-info/top_level.txt,sha256=qHoO4BhYDfeTkyKnciZSQtn5FSLN3Q-P5xCTkyvbuxg,26
110
+ ai_parrot-0.3.6.dist-info/RECORD,,
@@ -1,10 +1,26 @@
1
1
  from typing import Any
2
2
  from collections.abc import Callable
3
+ import math
3
4
  from pathlib import PurePath
4
5
  from langchain.docstore.document import Document
5
6
  from .basevideo import BaseVideoLoader
6
7
 
7
8
 
9
+ def split_text(text, max_length):
10
+ """Split text into chunks of a maximum length, ensuring not to break words."""
11
+ chunks = []
12
+ while len(text) > max_length:
13
+ # Find the last space before the max_length
14
+ split_point = text.rfind(' ', 0, max_length)
15
+ # If no space found, split at max_length
16
+ if split_point == -1:
17
+ split_point = max_length
18
+ chunks.append(text[:split_point])
19
+ text = text[split_point:].strip()
20
+ chunks.append(text)
21
+ return chunks
22
+
23
+
8
24
  class VideoLocalLoader(BaseVideoLoader):
9
25
  """
10
26
  Generating Video transcripts from local Videos.
@@ -54,14 +70,17 @@ class VideoLocalLoader(BaseVideoLoader):
54
70
  transcript = ''
55
71
  # Summarize the transcript
56
72
  if transcript:
73
+ # Split transcript into chunks
74
+ transcript_chunks = split_text(transcript, 32767)
57
75
  summary = self.get_summary_from_text(transcript)
58
76
  # Create Two Documents, one is for transcript, second is VTT:
59
77
  metadata['summary'] = summary
60
- doc = Document(
61
- page_content=transcript,
62
- metadata=metadata
63
- )
64
- documents.append(doc)
78
+ for chunk in transcript_chunks:
79
+ doc = Document(
80
+ page_content=chunk,
81
+ metadata=metadata
82
+ )
83
+ documents.append(doc)
65
84
  if transcript_whisper:
66
85
  # VTT version:
67
86
  transcript = self.transcript_to_vtt(transcript_whisper, transcript_path)
parrot/version.py CHANGED
@@ -3,7 +3,7 @@
3
3
  __title__ = "ai-parrot"
4
4
  __description__ = "Live Chatbots based on Langchain chatbots and Agents \
5
5
  Integrated into Navigator Framework or used into aiohttp applications."
6
- __version__ = "0.3.5"
6
+ __version__ = "0.3.6"
7
7
  __author__ = "Jesus Lara"
8
8
  __author_email__ = "jesuslarag@gmail.com"
9
9
  __license__ = "MIT"