File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed
Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1313from ..._base_client import (
1414 make_request_options ,
1515)
16- from ...types .context import CreateContextResponse
16+ from ...types .context import CreateContextResponse , CloneContextResponse
1717from ...types .context .context_create_params import TTLTypes , TruncationStrategy , to_optional_ttl
1818from ...types .chat import ChatCompletionMessageParam
1919
@@ -56,6 +56,30 @@ def create(
5656 cast_to = CreateContextResponse ,
5757 )
5858
59+ @with_sts_token
60+ def clone (
61+ self ,
62+ * ,
63+ context_id : str ,
64+ extra_headers : Headers | None = None ,
65+ extra_query : Query | None = None ,
66+ extra_body : Body | None = None ,
67+ timeout : float | httpx .Timeout | None = None ,
68+ ) -> CloneContextResponse :
69+ return self ._post (
70+ "/context/clone" ,
71+ body = {
72+ "context_id" : context_id ,
73+ },
74+ options = make_request_options (
75+ extra_headers = extra_headers ,
76+ extra_query = extra_query ,
77+ extra_body = extra_body ,
78+ timeout = timeout ,
79+ ),
80+ cast_to = CloneContextResponse ,
81+ )
82+
5983
6084class AsyncContext (AsyncAPIResource ):
6185 @cached_property
Original file line number Diff line number Diff line change 44
55from .context_chat_completion_chunk import ContextChatCompletionChunk
66from .context_chat_completion import ContextChatCompletion
7- from .create_context_response import CreateContextResponse
7+ from .create_context_response import CreateContextResponse , CloneContextResponse
88from .context_create_params import TruncationStrategy , TTLTypes
Original file line number Diff line number Diff line change 11from ..._models import BaseModel
22from .truncation_strategy import TruncationStrategy
33
4- __all__ = ["CreateContextResponse" ]
4+ __all__ = ["CreateContextResponse" , "CloneContextResponse" ]
55
66
77class CreateContextResponse (BaseModel ):
@@ -16,3 +16,7 @@ class CreateContextResponse(BaseModel):
1616 Controls for how a context will be truncated prior to the run.
1717 Use this to control the context window for the chat completion.
1818 """
19+
20+
21+ class CloneContextResponse (CreateContextResponse ):
22+ pass
You can’t perform that action at this time.
0 commit comments