LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

Chat LangChain

What can I help with?

Enter to send·Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithresourcessessionsSessionsResourcecreate_v2
Method●Since v0.15

create_v2

Copy
create_v2(
  self,
  *,
  type: Literal['PROJECT', 'AGENT', 'EXPERIMENT'],
View source on GitHub
upsert
:
bool
|
Omit
=
omit
,
id
:
str
|
Omit
=
omit
,
default_dataset_id
:
str
|
Omit
=
omit
,
description
:
str
|
Omit
=
omit
,
end_time
:
Union
[
str
,
datetime
]
|
Omit
=
omit
,
evaluator_keys
:
SequenceNotStr
[
str
]
|
Omit
=
omit
,
extra
:
Dict
[
str
,
object
]
|
Omit
=
omit
,
kicked_off_by
:
str
|
Omit
=
omit
,
longlived_ttl_days
:
Optional
[
int
]
|
Omit
=
omit
,
name
:
str
|
Omit
=
omit
,
num_examples
:
int
|
Omit
=
omit
,
num_repetitions
:
int
|
Omit
=
omit
,
reference_dataset_id
:
str
|
Omit
=
omit
,
start_time
:
Union
[
str
,
datetime
]
|
Omit
=
omit
,
tag_value_ids
:
SequenceNotStr
[
str
]
|
Omit
=
omit
,
trace_tier
:
Literal
[
'LONG_LIVED'
,
'SHORT_LIVED'
]
|
Omit
=
omit
,
extra_headers
:
Headers
|
None
=
None
,
extra_query
:
Query
|
None
=
None
,
extra_body
:
Body
|
None
=
None
,
timeout
:
float
|
httpx
.
Timeout
|
None
|
NotGiven
=
not_given
)
->
Session

Parameters

NameTypeDescription
type*Literal['PROJECT', 'AGENT', 'EXPERIMENT']

Type identifies a tracing project, Agent tracing project, or experiment.

upsertbool | Omit
Default:omit

Update an existing session with the same name

longlived_ttl_daysOptional[int] | Omit
Default:omit
extra_headersHeaders | None
Default:None
extra_queryQuery | None
Default:None
extra_bodyBody | None
Default:None
timeoutfloat | httpx.Timeout | None | NotGiven
Default:not_given

Create a session, or update an existing session with the same name when upsert is true. Returns the refreshed session representation without optional run statistics.

LonglivedTTLDays overrides long-lived trace retention. Null restores the workspace default.

Send extra headers

Add additional query parameters to the request

Add additional JSON properties to the request

Override the client-level default timeout for this request, in seconds