我们已发布Python SDK的v1.0版本。该SDK的HTTP层从httpx迁移至httpx2,这是一个持续维护且API兼容的分支:可从httpx2构建自定义的http_client、Timeout和transport对象(DefaultHttpxClient辅助函数保持不变),如果您依赖那些修补httpx的追踪或模拟库,请在启动时调用httpx2.alias_httpx()。v1.0要求Python 3.10或更高版本,并移除了长期弃用的接口,包括旧版文本补全API、Messages方法中的temperature、top_p和top_k参数,以及工具运行器中的客户端侧compaction_control。在异步客户端上,.with_raw_response结果现在需要await response.parse(),而AnthropicBedrock在未配置AWS区域时现在会抛出错误,而不是默认使用us-east-1。请参阅v1迁移指南,了解每项更改及前后代码片段。
We've released v1.0 of the Python SDK. The SDK's HTTP layer moves from httpx to httpx2, a maintained, API-compatible fork: build custom http_client, Timeout, and transport objects from httpx2 (the DefaultHttpxClient helpers are unchanged), and call httpx2.alias_httpx() at startup if you rely on tracing or mocking libraries that patch httpx. v1.0 requires Python 3.10 or later and removes long-deprecated surface, including the legacy Text Completions API, the temperature, top_p, and top_k parameters on Messages methods, and the tool runner's client-side compaction_control. On the async client, .with_raw_response results now need await response.parse(), and AnthropicBedrock now raises an error when no AWS region is configured instead of defaulting to us-east-1. See the v1 migration guide for every change with before-and-after snippets.
本文内容采集自官方网站,排版和翻译可能与原页面存在差异。
阅读官方全文