Skip to content

Commit 407ebef

Browse files
authored
Update TS types (#331)
Update the types of the objects
1 parent 3e67717 commit 407ebef

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "langsmith",
3-
"version": "0.0.51",
3+
"version": "0.0.52",
44
"description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
55
"files": [
66
"dist/",

js/src/schemas.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
export interface TracerSession {
2+
// The ID of the tenant, or organization
23
tenant_id: string;
4+
// The ID of the project (alias for session)
35
id: string;
6+
// The start time of the project
47
start_time: number;
8+
// The end time of the project
9+
end_time?: number;
10+
// A description of the project
11+
description?: string;
12+
// The name of the project
513
name?: string;
614
}
715

python/langsmith/schemas.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ class TracerSession(BaseModel):
379379
"""The ID of the project."""
380380
start_time: datetime = Field(default_factory=datetime.utcnow)
381381
"""The time the project was created."""
382+
end_time: Optional[datetime] = None
383+
"""The time the project was ended."""
384+
description: Optional[str] = None
385+
"""The description of the project."""
382386
name: Optional[str] = None
383387
"""The name of the session."""
384388
extra: Optional[Dict[str, Any]] = None
@@ -400,6 +404,20 @@ def url(self) -> Optional[str]:
400404
return f"{self._host_url}/o/{self.tenant_id}/projects/p/{self.id}"
401405
return None
402406

407+
@property
408+
def metadata(self) -> dict[str, Any]:
409+
"""Retrieve the metadata (if any)."""
410+
if self.extra is None or "metadata" not in self.extra:
411+
return {}
412+
return self.extra["metadata"]
413+
414+
@property
415+
def tags(self) -> List[str]:
416+
"""Retrieve the tags (if any)."""
417+
if self.extra is None or "tags" not in self.extra:
418+
return []
419+
return self.extra["tags"]
420+
403421

404422
class TracerSessionResult(TracerSession):
405423
"""TracerSession schema returned when reading a project

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "langsmith"
3-
version = "0.0.71"
3+
version = "0.0.72"
44
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
55
authors = ["LangChain <support@langchain.dev>"]
66
license = "MIT"

0 commit comments

Comments
 (0)