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_idIDbodyrequiredReturns: ChatSchema
show properties (11)hide properties (11)
idstringrequiredcreated_atstringrequiredteam_idstringrequiredteam_slugstringrequiredproject_idstringrequiredproject_slugstringrequiredtotal_messagesintegerrequiredcode_idstringrequiredversion_idOptional[string]titleOptional[string]chat_type'code' | 'analysis'requiredcreate_for_code
POST /chats
result = await client.chats.create_for_code(
code_id=code_id,
)Arguments:
code_idIDbodyrequiredReturns: ChatSchema
show properties (11)hide properties (11)
idstringrequiredcreated_atstringrequiredteam_idstringrequiredteam_slugstringrequiredproject_idstringrequiredproject_slugstringrequiredtotal_messagesintegerrequiredcode_idstringrequiredversion_idOptional[string]titleOptional[string]chat_type'code' | 'analysis'requiredlist
GET /chats
result = await client.chats.list()Arguments:
optionsChatsQueryParams | Nonequerydefault:
NoneChatsQueryParams
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_paginationboolquerydefault:
FalseReturn type by call:
with_pagination=True→PaginatedResource[ChatSchema]with_pagination=False→Pagination[ChatSchema]
show properties (6)hide properties (6)
resultsarray of ChatSchemashow properties (11)hide properties (11)
idstringrequiredcreated_atstringrequiredteam_idstringrequiredteam_slugstringrequiredproject_idstringrequiredproject_slugstringrequiredtotal_messagesintegerrequiredcode_idstringrequiredversion_idOptional[string]titleOptional[string]chat_type'code' | 'analysis'requiredpageintegerrequiredpage_sizeintegerrequiredmorebooleanrequiredtotal_observationsintegerrequiredtotal_pagesintegerrequiredget
GET /chats/{chat_id}
result = await client.chats.get(
chat_id=chat_id,
)Arguments:
chat_idIDpathrequiredReturns: ChatSchema
show properties (11)hide properties (11)
idstringrequiredcreated_atstringrequiredteam_idstringrequiredteam_slugstringrequiredproject_idstringrequiredproject_slugstringrequiredtotal_messagesintegerrequiredcode_idstringrequiredversion_idOptional[string]titleOptional[string]chat_type'code' | 'analysis'requiredmessages
GET /chats/{chat_id}/messages
result = await client.chats.messages(
chat_id=chat_id,
)Arguments:
chat_idIDpathrequiredReturns: ResultsResponse[ChatMessageSchema]
show properties (1)hide properties (1)
resultsarray of ChatMessageSchemashow properties (8)hide properties (8)
idstringrequiredcreated_atstringrequiredchat_idstringrequiredchat_role'user' | 'system' | 'assistant'requiredmessagestringrequiredrefsarray of InlineRefshow properties (6)hide properties (6)
idstringrequiredtypestringrequiredsourcestringrequiredref_indintegernameOptional[string]is_stalebooleanhas_proposalbooleanproposal_statusOptional[string]sync
POST /chats/{chat_id}/sync
result = await client.chats.sync(
chat_id=chat_id,
body=body,
)Arguments:
chat_idIDpathrequiredbodyChatMessageBodyDictbodyrequiredChatMessageBodyDict
messagestringrequiredis_retryOptional[boolean]approval_idOptional[string]is_approvedOptional[boolean]Returns: ChatMessageSchema
show properties (8)hide properties (8)
idstringrequiredcreated_atstringrequiredchat_idstringrequiredchat_role'user' | 'system' | 'assistant'requiredmessagestringrequiredrefsarray of InlineRefshow properties (6)hide properties (6)
idstringrequiredtypestringrequiredsourcestringrequiredref_indintegernameOptional[string]is_stalebooleanhas_proposalbooleanproposal_statusOptional[string]session_token
result = await client.chats.session_token(
chat_id=chat_id,
)Arguments:
chat_idIDbodyrequiredReturns: str
stream
POST /chats/{chat_id}/stream
result = await client.chats.stream(
chat_id=chat_id,
session_token=session_token,
body=body,
)Arguments:
chat_idIDpathrequiredsession_tokenstrbodyrequiredbodyChatMessageBodyDictbodyrequiredChatMessageBodyDict
messagestringrequiredis_retryOptional[boolean]approval_idOptional[string]is_approvedOptional[boolean]Returns: AsyncGenerator[StreamedMessageType]

