docent-python 0.1.48a0__tar.gz → 0.1.50a0__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.
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/PKG-INFO +1 -1
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/_tiktoken_util.py +6 -6
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/chat/content.py +6 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/transcript.py +1 -1
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/mcp/server.py +1 -1
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/sdk/client.py +432 -79
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/trace.py +43 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/pyproject.toml +1 -1
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/uv.lock +64 -67
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/.gitignore +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/LICENSE.md +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/README.md +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/data_models/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/data_models/exceptions.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/data_models/llm_output.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/llm_cache.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/llm_svc.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/model_registry.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/anthropic.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/common.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/google.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/openai.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/openrouter.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/preference_types.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_llm_util/providers/provider_registry.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_log_util/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/_log_util/logger.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/agent_run.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/chat/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/chat/message.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/chat/response_format.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/chat/tool.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/citation.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/formatted_objects.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/judge.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/metadata_util.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/regex.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/data_models/util.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/analysis.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/impl.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/runner.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/stats.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/types.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/forgiving_json.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/meta_schema.json +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/meta_schema.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/parse_output.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/template_formatter.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/judges/util/voting.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/loaders/load_inspect.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/mcp/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/mcp/__main__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/py.typed +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/samples/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/samples/load.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/samples/log.eval +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/samples/tb_airline.json +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/sdk/__init__.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/sdk/agent_run_writer.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/sdk/llm_context.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/sdk/llm_request.py +0 -0
- {docent_python-0.1.48a0 → docent_python-0.1.50a0}/docent/trace_temp.py +0 -0
|
@@ -9,15 +9,15 @@ def get_token_count(text: str, model: str = "gpt-4") -> int:
|
|
|
9
9
|
return len(encoding.encode(text, disallowed_special=()))
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def truncate_to_token_limit(
|
|
12
|
+
def truncate_to_token_limit(
|
|
13
|
+
text: str, max_tokens: int, model: str = "gpt-4"
|
|
14
|
+
) -> tuple[str, int, int]:
|
|
13
15
|
"""Truncate text to stay within the specified token limit."""
|
|
14
16
|
encoding = tiktoken.encoding_for_model(model)
|
|
15
17
|
tokens = encoding.encode(text, disallowed_special=())
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return encoding.decode(tokens[:max_tokens])
|
|
18
|
+
orig_num_tokens = len(tokens)
|
|
19
|
+
new_tokens = tokens[:max_tokens]
|
|
20
|
+
return encoding.decode(new_tokens), len(new_tokens), orig_num_tokens
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class MessageRange:
|
|
@@ -39,15 +39,21 @@ class ContentReasoning(BaseContent):
|
|
|
39
39
|
Attributes:
|
|
40
40
|
type: Fixed as "reasoning" to identify this content type.
|
|
41
41
|
reasoning: The actual reasoning text.
|
|
42
|
+
summary: Optional human-readable reasoning summary.
|
|
42
43
|
signature: Optional signature associated with the reasoning.
|
|
43
44
|
redacted: Flag indicating if the reasoning has been redacted.
|
|
44
45
|
"""
|
|
45
46
|
|
|
46
47
|
type: Literal["reasoning"] = "reasoning" # type: ignore
|
|
47
48
|
reasoning: str
|
|
49
|
+
summary: str | None = None
|
|
48
50
|
signature: str | None = None
|
|
49
51
|
redacted: bool = False
|
|
50
52
|
|
|
53
|
+
@property
|
|
54
|
+
def display_reasoning(self) -> str:
|
|
55
|
+
return self.summary if self.redacted and self.summary else self.reasoning
|
|
56
|
+
|
|
51
57
|
|
|
52
58
|
# Content type discriminated union
|
|
53
59
|
Content = Annotated[ContentText | ContentReasoning, Discriminator("type")]
|
|
@@ -179,7 +179,7 @@ def format_chat_message(
|
|
|
179
179
|
if isinstance(message, AssistantMessage) and message.content:
|
|
180
180
|
for content in message.content:
|
|
181
181
|
if isinstance(content, ContentReasoning):
|
|
182
|
-
cur_content = f"<reasoning>\n{content.
|
|
182
|
+
cur_content = f"<reasoning>\n{content.display_reasoning}\n</reasoning>\n"
|
|
183
183
|
|
|
184
184
|
# Main content text
|
|
185
185
|
cur_content += message.text
|
|
@@ -115,7 +115,7 @@ def navigate_to(collection_id: str, path: str) -> str:
|
|
|
115
115
|
return "Error: collection_id is required (pass explicitly or set DOCENT_COLLECTION_ID)"
|
|
116
116
|
|
|
117
117
|
path = path.lstrip("/")
|
|
118
|
-
url = f"{client.
|
|
118
|
+
url = f"{client._frontend_url}/dashboard/{collection_id}/{path}" # type: ignore[reportPrivateUsage]
|
|
119
119
|
|
|
120
120
|
webbrowser.open(url)
|
|
121
121
|
return f"Opened {url} in browser"
|