projectdavid 1.31.0__tar.gz → 1.31.1__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.

Potentially problematic release.


This version of projectdavid might be problematic. Click here for more details.

Files changed (66) hide show
  1. {projectdavid-1.31.0 → projectdavid-1.31.1}/CHANGELOG.md +7 -0
  2. {projectdavid-1.31.0/src/projectdavid.egg-info → projectdavid-1.31.1}/PKG-INFO +1 -2
  3. {projectdavid-1.31.0 → projectdavid-1.31.1}/pyproject.toml +1 -2
  4. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/file_processor.py +30 -80
  5. {projectdavid-1.31.0 → projectdavid-1.31.1/src/projectdavid.egg-info}/PKG-INFO +1 -2
  6. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid.egg-info/requires.txt +0 -1
  7. {projectdavid-1.31.0 → projectdavid-1.31.1}/LICENSE +0 -0
  8. {projectdavid-1.31.0 → projectdavid-1.31.1}/MANIFEST.in +0 -0
  9. {projectdavid-1.31.0 → projectdavid-1.31.1}/README.md +0 -0
  10. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/assistants.md +0 -0
  11. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/code_interpretation.md +0 -0
  12. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/database.md +0 -0
  13. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/database_assistant_example.md +0 -0
  14. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/docker_comtainers.md +0 -0
  15. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/file_search.md +0 -0
  16. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/files.md +0 -0
  17. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/function_call_definition.md +0 -0
  18. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/function_calls.md +0 -0
  19. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/handling_function_calls.md +0 -0
  20. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/inference.md +0 -0
  21. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/messages.md +0 -0
  22. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/runs.md +0 -0
  23. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/streams.md +0 -0
  24. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/threads.md +0 -0
  25. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/tools.md +0 -0
  26. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/users.md +0 -0
  27. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/vector_store.md +0 -0
  28. {projectdavid-1.31.0 → projectdavid-1.31.1}/docs/versioning.md +0 -0
  29. {projectdavid-1.31.0 → projectdavid-1.31.1}/setup.cfg +0 -0
  30. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/__init__.py +0 -0
  31. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/_version.py +0 -0
  32. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/actions_client.py +0 -0
  33. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/api_key_client.py +0 -0
  34. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/assistants_client.py +0 -0
  35. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/base_client.py +0 -0
  36. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/base_vector_store.py +0 -0
  37. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/event_handler.py +0 -0
  38. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/file_search.py +0 -0
  39. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/files_client.py +0 -0
  40. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/inference_client.py +0 -0
  41. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/messages_client.py +0 -0
  42. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/runs.py +0 -0
  43. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/synchronous_inference_wrapper.py +0 -0
  44. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/threads_client.py +0 -0
  45. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/tools_client.py +0 -0
  46. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/users_client.py +0 -0
  47. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/vector_store_manager.py +0 -0
  48. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/clients/vectors.py +0 -0
  49. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/constants/platform.py +0 -0
  50. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/entity.py +0 -0
  51. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/events.py +0 -0
  52. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/serializers.py +0 -0
  53. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/services/logging_service.py +0 -0
  54. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/synthesis/__init__.py +0 -0
  55. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/synthesis/llm_synthesizer.py +0 -0
  56. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/synthesis/prompt.py +0 -0
  57. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/synthesis/reranker.py +0 -0
  58. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/synthesis/retriever.py +0 -0
  59. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/utils/__init__.py +0 -0
  60. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/utils/monitor_launcher.py +0 -0
  61. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/utils/run_monitor.py +0 -0
  62. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid/utils/vector_search_formatter.py +0 -0
  63. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid.egg-info/SOURCES.txt +0 -0
  64. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid.egg-info/dependency_links.txt +0 -0
  65. {projectdavid-1.31.0 → projectdavid-1.31.1}/src/projectdavid.egg-info/top_level.txt +0 -0
  66. {projectdavid-1.31.0 → projectdavid-1.31.1}/tests/test_clients.py +0 -0
@@ -1,3 +1,10 @@
1
+ ## [1.31.1](https://github.com/frankie336/projectdavid/compare/v1.31.0...v1.31.1) (2025-05-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Remove magic dependency when finding file type ([7063c14](https://github.com/frankie336/projectdavid/commit/7063c14c3d9f21bc9bd9579d4d7d2c55004a627f))
7
+
1
8
  # [1.31.0](https://github.com/frankie336/projectdavid/compare/v1.30.4...v1.31.0) (2025-05-26)
2
9
 
3
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid
3
- Version: 1.31.0
3
+ Version: 1.31.1
4
4
  Summary: Python SDK for interacting with the Entities Assistant API.
5
5
  Author-email: Francis Neequaye Armah <francis.neequaye@projectdavid.co.uk>
6
6
  License: PolyForm Noncommercial License 1.0.0
@@ -27,7 +27,6 @@ Requires-Dist: validators<0.35.0,>=0.29.0
27
27
  Requires-Dist: sentence-transformers<5.0,>=3.4.0
28
28
  Requires-Dist: sseclient-py
29
29
  Requires-Dist: requests
30
- Requires-Dist: python-magic
31
30
  Requires-Dist: python-docx
32
31
  Requires-Dist: python-pptx
33
32
  Provides-Extra: dev
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "projectdavid"
7
- version = "1.31.0"
7
+ version = "1.31.1"
8
8
  description = "Python SDK for interacting with the Entities Assistant API."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -27,7 +27,6 @@ dependencies = [
27
27
  "sentence-transformers>=3.4.0,<5.0",
28
28
  "sseclient-py",
29
29
  "requests",
30
- "python-magic",
31
30
  "python-docx",
32
31
  "python-pptx",
33
32
 
@@ -1,7 +1,6 @@
1
1
  import asyncio
2
2
  import csv
3
3
  import json
4
- import mimetypes
5
4
  import re
6
5
  import textwrap
7
6
  from concurrent.futures import ThreadPoolExecutor
@@ -10,10 +9,9 @@ from typing import Any, Dict, List, Tuple, Union
10
9
 
11
10
  try: # Python 3.11+
12
11
  from typing import LiteralString
13
- except ImportError: # 3.9 - 3.10
12
+ except ImportError: # 3.93.10
14
13
  from typing_extensions import LiteralString
15
14
 
16
- import magic
17
15
  import numpy as np
18
16
  import pdfplumber
19
17
  from docx import Document
@@ -54,54 +52,30 @@ class FileProcessor:
54
52
  raise ValueError(f"{file_path.name} > {mb} MB limit")
55
53
 
56
54
  # ------------------------------------------------------------------ #
57
- # File-type detection (extension + MIME)
55
+ # File-type detection (simple extension map – NO libmagic)
58
56
  # ------------------------------------------------------------------ #
59
57
  def _detect_file_type(self, file_path: Path) -> str:
60
58
  """
61
- Return a handler tag:
59
+ Return one of:
62
60
 
63
- • 'pdf' • 'csv'
64
- • 'json' 'office'
65
- • 'text'
61
+ • 'pdf' • 'csv' • 'json'
62
+ • 'office' (.doc/.docx/.pptx)
63
+ • 'text' (code / markup / plain text)
66
64
 
67
- Raises *ValueError* on anything unknown.
65
+ Raises *ValueError* if the extension is not recognised.
68
66
  """
69
- # 1️⃣ Best-effort MIME sniff
70
- mime_type: str | None = None
71
- if magic is not None:
72
- try:
73
- mime_type = magic.from_file(str(file_path), mime=True)
74
- except Exception:
75
- mime_type = None
76
-
77
- # 2️⃣ Fallback → mimetypes
78
- if not mime_type:
79
- mime_type, _ = mimetypes.guess_type(file_path.name)
80
-
81
67
  suffix = file_path.suffix.lower()
82
68
 
83
- PDF_MIMES = {"application/pdf"}
84
- CSV_MIMES = {"text/csv", "application/csv"}
85
- JSON_MIMES = {"application/json"}
86
- OFFICE_MIMES = {
87
- "application/msword",
88
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
89
- "application/vnd.openxmlformats-officedocument.presentationml.presentation",
90
- }
91
- TEXT_MIMES = {
92
- "text/plain",
93
- "text/markdown",
94
- "text/x-python",
95
- "text/x-c",
96
- "text/x-c++",
97
- "text/x-java-source",
98
- "text/x-script.python",
99
- "text/html",
100
- "text/css",
101
- "application/typescript",
102
- "text/javascript",
103
- }
104
- TEXT_EXTS = {
69
+ if suffix == ".pdf":
70
+ return "pdf"
71
+ if suffix == ".csv":
72
+ return "csv"
73
+ if suffix == ".json":
74
+ return "json"
75
+ if suffix in {".doc", ".docx", ".pptx"}:
76
+ return "office"
77
+
78
+ text_exts = {
105
79
  ".txt",
106
80
  ".md",
107
81
  ".rst",
@@ -120,32 +94,10 @@ class FileProcessor:
120
94
  ".html",
121
95
  ".css",
122
96
  }
123
-
124
- # --- PDF ---
125
- if mime_type in PDF_MIMES or suffix == ".pdf":
126
- return "pdf"
127
-
128
- # --- CSV ---
129
- if mime_type in CSV_MIMES or suffix == ".csv":
130
- return "csv"
131
-
132
- # --- JSON ---
133
- if mime_type in JSON_MIMES or suffix == ".json":
134
- return "json"
135
-
136
- # --- Office documents ---
137
- if mime_type in OFFICE_MIMES or suffix in {".doc", ".docx", ".pptx"}:
138
- return "office"
139
-
140
- # --- Generic text / code / markup ---
141
- if mime_type in TEXT_MIMES or suffix in TEXT_EXTS:
97
+ if suffix in text_exts:
142
98
  return "text"
143
99
 
144
- # --- Unsupported ---
145
- raise ValueError(
146
- f"Unsupported file type for '{file_path.name}': "
147
- f"MIME={mime_type or 'unknown'} extension={suffix}"
148
- )
100
+ raise ValueError(f"Unsupported file type: {file_path.name} (ext={suffix})")
149
101
 
150
102
  # ------------------------------------------------------------------ #
151
103
  # Public entry-point
@@ -156,19 +108,17 @@ class FileProcessor:
156
108
  self.validate_file(file_path)
157
109
  ftype = self._detect_file_type(file_path)
158
110
 
159
- if ftype == "pdf":
160
- return await self._process_pdf(file_path)
161
- if ftype == "text":
162
- return await self._process_text(file_path)
163
- if ftype == "csv":
164
- return await self._process_csv(file_path)
165
- if ftype == "office":
166
- return await self._process_office(file_path)
167
- if ftype == "json":
168
- return await self._process_json(file_path)
169
-
170
- # Safety net (should never hit)
171
- raise ValueError(f"Unsupported file type: {file_path.suffix}")
111
+ dispatch_map = {
112
+ "pdf": self._process_pdf,
113
+ "text": self._process_text,
114
+ "csv": self._process_csv,
115
+ "office": self._process_office,
116
+ "json": self._process_json,
117
+ }
118
+ if ftype not in dispatch_map:
119
+ raise ValueError(f"Unsupported file type: {file_path.suffix}")
120
+
121
+ return await dispatch_map[ftype](file_path)
172
122
 
173
123
  # ------------------------------------------------------------------ #
174
124
  # PDF
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: projectdavid
3
- Version: 1.31.0
3
+ Version: 1.31.1
4
4
  Summary: Python SDK for interacting with the Entities Assistant API.
5
5
  Author-email: Francis Neequaye Armah <francis.neequaye@projectdavid.co.uk>
6
6
  License: PolyForm Noncommercial License 1.0.0
@@ -27,7 +27,6 @@ Requires-Dist: validators<0.35.0,>=0.29.0
27
27
  Requires-Dist: sentence-transformers<5.0,>=3.4.0
28
28
  Requires-Dist: sseclient-py
29
29
  Requires-Dist: requests
30
- Requires-Dist: python-magic
31
30
  Requires-Dist: python-docx
32
31
  Requires-Dist: python-pptx
33
32
  Provides-Extra: dev
@@ -10,7 +10,6 @@ validators<0.35.0,>=0.29.0
10
10
  sentence-transformers<5.0,>=3.4.0
11
11
  sseclient-py
12
12
  requests
13
- python-magic
14
13
  python-docx
15
14
  python-pptx
16
15
 
File without changes
File without changes
File without changes
File without changes