Chats

Python SDK reference for the chats resource

Note

The Bevor SDK is coming soon. This page previews its planned Python interface.

Access this resource from client.chats. Both async and sync clients expose the same methods.

create_for_analysis

POST /chats

result = await client.chats.create_for_analysis(
    version_id=version_id,
)

Arguments:

version_idIDbodyrequired

Returns: ChatSchema

show properties (11)hide properties (11)
idstringrequired
created_atstringrequired
team_idstringrequired
team_slugstringrequired
project_idstringrequired
project_slugstringrequired
total_messagesintegerrequired
code_idstringrequired
version_idOptional[string]
titleOptional[string]
chat_type'code' | 'analysis'required

create_for_code

POST /chats

result = await client.chats.create_for_code(
    code_id=code_id,
)

Arguments:

code_idIDbodyrequired

Returns: ChatSchema

show properties (11)hide properties (11)
idstringrequired
created_atstringrequired
team_idstringrequired
team_slugstringrequired
project_idstringrequired
project_slugstringrequired
total_messagesintegerrequired
code_idstringrequired
version_idOptional[string]
titleOptional[string]
chat_type'code' | 'analysis'required

list

GET /chats

result = await client.chats.list()

Arguments:

optionsChatsQueryParams | Nonequery
default:None

ChatsQueryParams

pageOptional[integer]
page_sizeOptional[integer]
order_byOptional['created_at' | 'updated_at']
orderOptional['desc' | 'asc']
project_idOptional[string]
project_slugOptional[string]
code_idOptional[string]
version_idOptional[string]
with_paginationboolquery
default:False

Return type by call:

  • with_pagination=True → PaginatedResource[ChatSchema]
  • with_pagination=False → Pagination[ChatSchema]
show properties (6)hide properties (6)
resultsarray of ChatSchema
show properties (11)hide properties (11)
idstringrequired
created_atstringrequired
team_idstringrequired
team_slugstringrequired
project_idstringrequired
project_slugstringrequired
total_messagesintegerrequired
code_idstringrequired
version_idOptional[string]
titleOptional[string]
chat_type'code' | 'analysis'required
pageintegerrequired
page_sizeintegerrequired
morebooleanrequired
total_observationsintegerrequired
total_pagesintegerrequired

get

GET /chats/{chat_id}

result = await client.chats.get(
    chat_id=chat_id,
)

Arguments:

chat_idIDpathrequired

Returns: ChatSchema

show properties (11)hide properties (11)
idstringrequired
created_atstringrequired
team_idstringrequired
team_slugstringrequired
project_idstringrequired
project_slugstringrequired
total_messagesintegerrequired
code_idstringrequired
version_idOptional[string]
titleOptional[string]
chat_type'code' | 'analysis'required

messages

GET /chats/{chat_id}/messages

result = await client.chats.messages(
    chat_id=chat_id,
)

Arguments:

chat_idIDpathrequired

Returns: ResultsResponse[ChatMessageSchema]

show properties (1)hide properties (1)
resultsarray of ChatMessageSchema
show properties (8)hide properties (8)
idstringrequired
created_atstringrequired
chat_idstringrequired
chat_role'user' | 'system' | 'assistant'required
messagestringrequired
refsarray of InlineRef
show properties (6)hide properties (6)
idstringrequired
typestringrequired
sourcestringrequired
ref_indinteger
nameOptional[string]
is_staleboolean
has_proposalboolean
proposal_statusOptional[string]

sync

POST /chats/{chat_id}/sync

result = await client.chats.sync(
    chat_id=chat_id,
    body=body,
)

Arguments:

chat_idIDpathrequired
bodyChatMessageBodyDictbodyrequired

ChatMessageBodyDict

messagestringrequired
is_retryOptional[boolean]
approval_idOptional[string]
is_approvedOptional[boolean]

Returns: ChatMessageSchema

show properties (8)hide properties (8)
idstringrequired
created_atstringrequired
chat_idstringrequired
chat_role'user' | 'system' | 'assistant'required
messagestringrequired
refsarray of InlineRef
show properties (6)hide properties (6)
idstringrequired
typestringrequired
sourcestringrequired
ref_indinteger
nameOptional[string]
is_staleboolean
has_proposalboolean
proposal_statusOptional[string]

session_token

result = await client.chats.session_token(
    chat_id=chat_id,
)

Arguments:

chat_idIDbodyrequired

Returns: str

stream

POST /chats/{chat_id}/stream

result = await client.chats.stream(
    chat_id=chat_id,
    session_token=session_token,
    body=body,
)

Arguments:

chat_idIDpathrequired
session_tokenstrbodyrequired
bodyChatMessageBodyDictbodyrequired

ChatMessageBodyDict

messagestringrequired
is_retryOptional[boolean]
approval_idOptional[string]
is_approvedOptional[boolean]

Returns: AsyncGenerator[StreamedMessageType]

On this page