API参考
本文档提供了 Bohrium OpenAPI Python SDK 的完整API参考。
客户端类
- class bohrium.Bohrium(access_key: str | None = None, app_key: str | None = None, base_url: str | URL | None = None, project_id: str | None = None, timeout: float | Timeout | None = 30.0, max_retries: int | None = 2, http_client: Client | None = None)[源代码]
-
- property default_headers: dict[str, str]
- job: resources.Job
- sigma_search: resources.SigmaSearch
- uni_parser: resources.UniParser
- knowledge_base: resources.KnowledgeBase
- paper: resources.Paper
- access_key: str
- project_id: str | None
- class bohrium.AsyncBohrium(*, _version: str | None = None, base_url: str | URL, limits: Limits, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), custom_headers: Mapping[str, str] | None = None)[源代码]
- class bohrium.AsyncAPIClient(*, _version: str | None = None, base_url: str | URL, limits: Limits, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
BaseClient[AsyncClient]
- class bohrium.SyncAPIClient(base_url: str | URL, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), limits: Limits = Limits(max_connections=1000, max_keepalive_connections=100, keepalive_expiry=5.0), _version: str | None = None, http_client: Client | None = None, custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
BaseClient[Client]
- class bohrium.BaseClient(*, _version: str | None = None, base_url: str | URL, limits: Limits, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
Generic[_HttpxClientT]- property auth_headers: dict[str, str]
- property custom_auth: Auth | None
- property default_headers: dict[str, str]
- property default_params: dict[str, str]
- max_retries: int
- timeout: float | Timeout | None
主客户端
- class bohrium.Bohrium(access_key: str | None = None, app_key: str | None = None, base_url: str | URL | None = None, project_id: str | None = None, timeout: float | Timeout | None = 30.0, max_retries: int | None = 2, http_client: Client | None = None)[源代码]
-
- access_key: str
- project_id: str | None
- job: resources.Job
- sigma_search: resources.SigmaSearch
- max_retries: int
- timeout: float | Timeout | None
- uni_parser: resources.UniParser
- knowledge_base: resources.KnowledgeBase
- paper: resources.Paper
- property default_headers: dict[str, str]
异步客户端
基础客户端类
- class bohrium.SyncAPIClient(base_url: str | URL, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), limits: Limits = Limits(max_connections=1000, max_keepalive_connections=100, keepalive_expiry=5.0), _version: str | None = None, http_client: Client | None = None, custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
BaseClient[Client]
- class bohrium.AsyncAPIClient(*, _version: str | None = None, base_url: str | URL, limits: Limits, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
BaseClient[AsyncClient]
- class bohrium.BaseClient(*, _version: str | None = None, base_url: str | URL, limits: Limits, max_retries: int = 2, timeout: float | Timeout | None = Timeout(connect=5.0, read=600.0, write=600.0, pool=600.0), custom_headers: Mapping[str, str] | None = None)[源代码]
基类:
Generic[_HttpxClientT]- max_retries: int
- timeout: float | Timeout | None
- property custom_auth: Auth | None
- property auth_headers: dict[str, str]
- property default_headers: dict[str, str]
- property default_params: dict[str, str]
资源模块
任务管理 (Job)
- class bohrium.resources.job.Job(client: Bohrium)[源代码]
基类:
SyncAPIResource
- class bohrium.resources.job.AsyncJob(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource
- class bohrium.resources.job.Job(client: Bohrium)[源代码]
基类:
SyncAPIResource
- class bohrium.resources.job.AsyncJob(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource
Sigma搜索
- class bohrium.resources.sigma_search.SigmaSearch(client: Bohrium)[源代码]
基类:
SyncAPIResourceSigma搜索相关接口
- create_session(query: str, model: str = 'qwen', discipline: str = 'All', resource_id_list: List[str] | None = None, **kwargs)[源代码]
创建搜索会话
- search_with_request(request: CreateSessionRequest | FollowUpRequest)[源代码]
使用请求对象进行搜索
- class bohrium.resources.sigma_search.AsyncSigmaSearch(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步Sigma搜索相关接口
- class bohrium.resources.sigma_search.SigmaSearch(client: Bohrium)[源代码]
基类:
SyncAPIResourceSigma搜索相关接口
- create_session(query: str, model: str = 'qwen', discipline: str = 'All', resource_id_list: List[str] | None = None, **kwargs)[源代码]
创建搜索会话
- search_with_request(request: CreateSessionRequest | FollowUpRequest)[源代码]
使用请求对象进行搜索
- class bohrium.resources.sigma_search.AsyncSigmaSearch(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步Sigma搜索相关接口
通用解析器
- class bohrium.resources.uni_parser.UniParser(client: Bohrium)[源代码]
基类:
SyncAPIResource通用解析器相关接口
- get_formatted(token: str, return_half: bool = False, content: bool = False, objects: bool = True, pages_dict: bool = False, textual: str = 'markup', table: str = 'markup', molecule: str = 'markup', chart: str = 'markup', figure: str = 'markup', expression: str = 'markup', equation: str = 'markup', molecule_source: bool = True, **kwargs)[源代码]
根据Token索引解析结果并进行指定格式化
- get_result(token: str, return_half: bool = False, content: bool = True, objects: bool = True, pages_dict: bool = True, molecule_source: bool = False, **kwargs)[源代码]
根据Token索引解析结果
- parse_with_request(request: FileParseRequest | URLParseRequest | ImageParseRequest | ParseResultRequest | ParseFormattedRequest | ParseParagraphsRequest)[源代码]
使用请求对象进行解析或查询
- trigger_file_async(file: str | BinaryIO | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交PDF文件进行异步/同步解析
- trigger_snip_async(img: str | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交图片或截图进行异步/同步解析
- trigger_url_async(url: str, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交PDF文件链接进行异步/同步解析
- class bohrium.resources.uni_parser.AsyncUniParser(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步通用解析器相关接口
- class bohrium.resources.uni_parser.UniParser(client: Bohrium)[源代码]
基类:
SyncAPIResource通用解析器相关接口
- trigger_file_async(file: str | BinaryIO | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交PDF文件进行异步/同步解析
- trigger_url_async(url: str, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交PDF文件链接进行异步/同步解析
- trigger_snip_async(img: str | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
提交图片或截图进行异步/同步解析
- get_result(token: str, return_half: bool = False, content: bool = True, objects: bool = True, pages_dict: bool = True, molecule_source: bool = False, **kwargs)[源代码]
根据Token索引解析结果
- get_formatted(token: str, return_half: bool = False, content: bool = False, objects: bool = True, pages_dict: bool = False, textual: str = 'markup', table: str = 'markup', molecule: str = 'markup', chart: str = 'markup', figure: str = 'markup', expression: str = 'markup', equation: str = 'markup', molecule_source: bool = True, **kwargs)[源代码]
根据Token索引解析结果并进行指定格式化
- parse_with_request(request: FileParseRequest | URLParseRequest | ImageParseRequest | ParseResultRequest | ParseFormattedRequest | ParseParagraphsRequest)[源代码]
使用请求对象进行解析或查询
- class bohrium.resources.uni_parser.AsyncUniParser(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步通用解析器相关接口
知识库
- class bohrium.resources.knowledge_base.KnowledgeBase(client: Bohrium)[源代码]
基类:
SyncAPIResource知识库相关接口
- class bohrium.resources.knowledge_base.AsyncKnowledgeBase(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步知识库相关接口
- class bohrium.resources.knowledge_base.KnowledgeBase(client: Bohrium)[源代码]
基类:
SyncAPIResource知识库相关接口
- class bohrium.resources.knowledge_base.AsyncKnowledgeBase(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步知识库相关接口
论文管理
- class bohrium.resources.paper.AsyncPaper(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步论文相关接口
- class bohrium.resources.paper.AsyncPaper(client: AsyncBohrium)[源代码]
基类:
AsyncAPIResource异步论文相关接口
类型定义
任务类型
Sigma搜索类型
- class bohrium.types.sigma_search.CreateSessionRequest(query: str, model: str = 'qwen', discipline: str = 'All', resource_id_list: List[str] | None = None, **kwargs)[源代码]
基类:
object创建搜索会话请求
- class bohrium.types.sigma_search.FollowUpRequest(session_uuid: str, query: str, **kwargs)[源代码]
基类:
object追问请求
- class bohrium.types.sigma_search.SessionInfo(uuid: str = '', title: str = '', status: str = '', share: bool = False, share_link: str = '', model: str = '', model_type: str = '', questions: List[Dict[str, Any]] | None = None, resources: Any | None = None, create_time: str = '', permission: int = 0, discipline: str = '', **kwargs)[源代码]
基类:
object会话信息
- class bohrium.types.sigma_search.QuestionInfo(id: int = 0, query: str = '', status: str = '', last_answer_id: int = 0, **kwargs)[源代码]
基类:
object问题信息
- class bohrium.types.sigma_search.PaperInfo(sequence_id: int = 0, author: List[str] | None = None, link: str = '', source: str = '', source_zh: str = '', abstract: str = '', abstract_zh: str = '', title: str = '', title_zh: str = '', seo_title: str = '', doi: str = '', bohrium_id: str = '', publication_id: int = 0, publication_cover: str = '', publication_date: str = '', journal: str = '', arxiv: str = '', ai_summarize: str = '', open_access: str = '', pdf_flag: bool = False, pieces: str = '', sort_score: float = 0.0, relevance_score: float = 0.0, publication_score: float = 0.0, impact_factor: float = 0.0, impact_factor_score: float = 0.0, citation_nums: int = 0, full_text: str = '', figures: Any | None = None, **kwargs)[源代码]
基类:
object论文信息
- class bohrium.types.sigma_search.SearchHistoryResponse(sessions: List[SessionInfo] | None = None, **kwargs)[源代码]
基类:
object搜索历史响应
通用解析器类型
- class bohrium.types.uni_parser.FileParseRequest(file: str | BinaryIO | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
基类:
object文件解析请求
- class bohrium.types.uni_parser.URLParseRequest(url: str, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
基类:
objectURL解析请求
- class bohrium.types.uni_parser.ImageParseRequest(img: str | bytes, lang: str = 'unknown', sync: bool = False, textual: bool = True, table: bool = True, molecule: bool = True, chart: bool = True, figure: bool = False, expression: bool = True, equation: bool = True, pages: List[int] | None = None, admin_debug: bool = False, timeout: int = 1800, table_cls: bool = False, ordering_method: str = 'gap_tree', **kwargs)[源代码]
基类:
object图片解析请求
- class bohrium.types.uni_parser.ParseResultRequest(token: str, return_half: bool = False, content: bool = True, objects: bool = True, pages_dict: bool = True, molecule_source: bool = False, **kwargs)[源代码]
基类:
object解析结果查询请求
- class bohrium.types.uni_parser.ParseFormattedRequest(token: str, return_half: bool = False, content: bool = False, objects: bool = True, pages_dict: bool = False, textual: str = 'markup', table: str = 'markup', molecule: str = 'markup', chart: str = 'markup', figure: str = 'markup', expression: str = 'markup', equation: str = 'markup', molecule_source: bool = True, **kwargs)[源代码]
基类:
object格式化解析结果查询请求
知识库类型
- class bohrium.types.knowledge_base.HybridRecallRequest(knowledge_base_id: int, text: str, k: int = 200, keywords: Dict[str, float] | None = None, **kwargs)[源代码]
基类:
object知识库混合召回请求
- class bohrium.types.knowledge_base.PaperRecallRequest(text: str, k: int, papers: List[Dict[str, str]], **kwargs)[源代码]
基类:
object单篇论文召回请求
论文类型
异常类
- exception bohrium._exceptions.BadRequestError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[400] = 400
- exception bohrium._exceptions.AuthenticationError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[401] = 401
- exception bohrium._exceptions.PermissionDeniedError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[403] = 403
- exception bohrium._exceptions.NotFoundError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[404] = 404
- exception bohrium._exceptions.ConflictError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[409] = 409
- exception bohrium._exceptions.UnprocessableEntityError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[422] = 422
- exception bohrium._exceptions.RateLimitError(message: str, *, response: Response, body: object | None)[源代码]
-
- status_code: Literal[429] = 429