agentlin-client 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agentlin-client might be problematic. Click here for more details.

Files changed (159) hide show
  1. agentlin_client-0.1.0/.gitignore +15 -0
  2. agentlin_client-0.1.0/.release-please-manifest.json +3 -0
  3. agentlin_client-0.1.0/CHANGELOG.md +16 -0
  4. agentlin_client-0.1.0/CONTRIBUTING.md +128 -0
  5. agentlin_client-0.1.0/LICENSE +7 -0
  6. agentlin_client-0.1.0/PKG-INFO +429 -0
  7. agentlin_client-0.1.0/README.md +394 -0
  8. agentlin_client-0.1.0/SECURITY.md +27 -0
  9. agentlin_client-0.1.0/api.md +92 -0
  10. agentlin_client-0.1.0/bin/check-release-environment +21 -0
  11. agentlin_client-0.1.0/bin/publish-pypi +6 -0
  12. agentlin_client-0.1.0/examples/.keep +4 -0
  13. agentlin_client-0.1.0/noxfile.py +9 -0
  14. agentlin_client-0.1.0/pyproject.toml +267 -0
  15. agentlin_client-0.1.0/release-please-config.json +66 -0
  16. agentlin_client-0.1.0/requirements-dev.lock +137 -0
  17. agentlin_client-0.1.0/requirements.lock +75 -0
  18. agentlin_client-0.1.0/src/agentlin/lib/.keep +4 -0
  19. agentlin_client-0.1.0/src/agentlin_client/__init__.py +90 -0
  20. agentlin_client-0.1.0/src/agentlin_client/_base_client.py +1995 -0
  21. agentlin_client-0.1.0/src/agentlin_client/_client.py +403 -0
  22. agentlin_client-0.1.0/src/agentlin_client/_compat.py +219 -0
  23. agentlin_client-0.1.0/src/agentlin_client/_constants.py +14 -0
  24. agentlin_client-0.1.0/src/agentlin_client/_exceptions.py +108 -0
  25. agentlin_client-0.1.0/src/agentlin_client/_files.py +123 -0
  26. agentlin_client-0.1.0/src/agentlin_client/_models.py +835 -0
  27. agentlin_client-0.1.0/src/agentlin_client/_qs.py +150 -0
  28. agentlin_client-0.1.0/src/agentlin_client/_resource.py +43 -0
  29. agentlin_client-0.1.0/src/agentlin_client/_response.py +832 -0
  30. agentlin_client-0.1.0/src/agentlin_client/_streaming.py +333 -0
  31. agentlin_client-0.1.0/src/agentlin_client/_types.py +260 -0
  32. agentlin_client-0.1.0/src/agentlin_client/_utils/__init__.py +64 -0
  33. agentlin_client-0.1.0/src/agentlin_client/_utils/_compat.py +45 -0
  34. agentlin_client-0.1.0/src/agentlin_client/_utils/_datetime_parse.py +136 -0
  35. agentlin_client-0.1.0/src/agentlin_client/_utils/_logs.py +25 -0
  36. agentlin_client-0.1.0/src/agentlin_client/_utils/_proxy.py +65 -0
  37. agentlin_client-0.1.0/src/agentlin_client/_utils/_reflection.py +42 -0
  38. agentlin_client-0.1.0/src/agentlin_client/_utils/_resources_proxy.py +24 -0
  39. agentlin_client-0.1.0/src/agentlin_client/_utils/_streams.py +12 -0
  40. agentlin_client-0.1.0/src/agentlin_client/_utils/_sync.py +86 -0
  41. agentlin_client-0.1.0/src/agentlin_client/_utils/_transform.py +457 -0
  42. agentlin_client-0.1.0/src/agentlin_client/_utils/_typing.py +156 -0
  43. agentlin_client-0.1.0/src/agentlin_client/_utils/_utils.py +421 -0
  44. agentlin_client-0.1.0/src/agentlin_client/_version.py +4 -0
  45. agentlin_client-0.1.0/src/agentlin_client/lib/.keep +4 -0
  46. agentlin_client-0.1.0/src/agentlin_client/py.typed +0 -0
  47. agentlin_client-0.1.0/src/agentlin_client/resources/__init__.py +33 -0
  48. agentlin_client-0.1.0/src/agentlin_client/resources/conversations/__init__.py +33 -0
  49. agentlin_client-0.1.0/src/agentlin_client/resources/conversations/conversations.py +489 -0
  50. agentlin_client-0.1.0/src/agentlin_client/resources/conversations/items.py +558 -0
  51. agentlin_client-0.1.0/src/agentlin_client/resources/responses.py +1136 -0
  52. agentlin_client-0.1.0/src/agentlin_client/types/__init__.py +22 -0
  53. agentlin_client-0.1.0/src/agentlin_client/types/conversation_create_params.py +28 -0
  54. agentlin_client-0.1.0/src/agentlin_client/types/conversation_delete_response.py +15 -0
  55. agentlin_client-0.1.0/src/agentlin_client/types/conversation_update_params.py +20 -0
  56. agentlin_client-0.1.0/src/agentlin_client/types/conversations/__init__.py +74 -0
  57. agentlin_client-0.1.0/src/agentlin_client/types/conversations/code_interpreter_tool_call.py +55 -0
  58. agentlin_client-0.1.0/src/agentlin_client/types/conversations/code_interpreter_tool_call_param.py +54 -0
  59. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_screenshot_image.py +22 -0
  60. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_screenshot_image_param.py +21 -0
  61. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_tool_call.py +201 -0
  62. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_tool_call_output_resource.py +37 -0
  63. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_tool_call_param.py +199 -0
  64. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_tool_call_safety_check.py +16 -0
  65. agentlin_client-0.1.0/src/agentlin_client/types/conversations/computer_tool_call_safety_check_param.py +18 -0
  66. agentlin_client-0.1.0/src/agentlin_client/types/conversations/conversation_item.py +133 -0
  67. agentlin_client-0.1.0/src/agentlin_client/types/conversations/conversation_item_list.py +26 -0
  68. agentlin_client-0.1.0/src/agentlin_client/types/conversations/conversation_resource.py +32 -0
  69. agentlin_client-0.1.0/src/agentlin_client/types/conversations/custom_tool_call.py +25 -0
  70. agentlin_client-0.1.0/src/agentlin_client/types/conversations/custom_tool_call_output.py +26 -0
  71. agentlin_client-0.1.0/src/agentlin_client/types/conversations/custom_tool_call_output_param.py +27 -0
  72. agentlin_client-0.1.0/src/agentlin_client/types/conversations/custom_tool_call_param.py +24 -0
  73. agentlin_client-0.1.0/src/agentlin_client/types/conversations/easy_input_message.py +26 -0
  74. agentlin_client-0.1.0/src/agentlin_client/types/conversations/easy_input_message_param.py +27 -0
  75. agentlin_client-0.1.0/src/agentlin_client/types/conversations/file_search_tool_call.py +42 -0
  76. agentlin_client-0.1.0/src/agentlin_client/types/conversations/file_search_tool_call_param.py +44 -0
  77. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_and_custom_tool_call_output.py +15 -0
  78. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_and_custom_tool_call_output_param.py +16 -0
  79. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_call_item_status.py +7 -0
  80. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_tool_call.py +32 -0
  81. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_tool_call_output_resource.py +33 -0
  82. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_tool_call_param.py +31 -0
  83. agentlin_client-0.1.0/src/agentlin_client/types/conversations/function_tool_call_resource.py +10 -0
  84. agentlin_client-0.1.0/src/agentlin_client/types/conversations/image_gen_tool_call.py +22 -0
  85. agentlin_client-0.1.0/src/agentlin_client/types/conversations/image_gen_tool_call_param.py +22 -0
  86. agentlin_client-0.1.0/src/agentlin_client/types/conversations/includable.py +14 -0
  87. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_content.py +32 -0
  88. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_content_param.py +30 -0
  89. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_file_content.py +25 -0
  90. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_file_content_param.py +25 -0
  91. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_image_content.py +28 -0
  92. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_image_content_param.py +28 -0
  93. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_item.py +209 -0
  94. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_item_param.py +203 -0
  95. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_message.py +30 -0
  96. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_message_param.py +31 -0
  97. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_text_content.py +15 -0
  98. agentlin_client-0.1.0/src/agentlin_client/types/conversations/input_text_content_param.py +15 -0
  99. agentlin_client-0.1.0/src/agentlin_client/types/conversations/item_create_params.py +24 -0
  100. agentlin_client-0.1.0/src/agentlin_client/types/conversations/item_list_params.py +50 -0
  101. agentlin_client-0.1.0/src/agentlin_client/types/conversations/item_retrieve_params.py +22 -0
  102. agentlin_client-0.1.0/src/agentlin_client/types/conversations/local_shell_tool_call.py +45 -0
  103. agentlin_client-0.1.0/src/agentlin_client/types/conversations/local_shell_tool_call_output.py +22 -0
  104. agentlin_client-0.1.0/src/agentlin_client/types/conversations/local_shell_tool_call_output_param.py +22 -0
  105. agentlin_client-0.1.0/src/agentlin_client/types/conversations/local_shell_tool_call_param.py +47 -0
  106. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_approval_request.py +24 -0
  107. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_approval_request_param.py +24 -0
  108. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_approval_response_resource.py +25 -0
  109. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_list_tools.py +39 -0
  110. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_list_tools_param.py +39 -0
  111. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_tool_call.py +44 -0
  112. agentlin_client-0.1.0/src/agentlin_client/types/conversations/mcp_tool_call_param.py +44 -0
  113. agentlin_client-0.1.0/src/agentlin_client/types/conversations/output_message.py +34 -0
  114. agentlin_client-0.1.0/src/agentlin_client/types/conversations/output_message_param.py +34 -0
  115. agentlin_client-0.1.0/src/agentlin_client/types/conversations/output_text_content.py +117 -0
  116. agentlin_client-0.1.0/src/agentlin_client/types/conversations/output_text_content_param.py +115 -0
  117. agentlin_client-0.1.0/src/agentlin_client/types/conversations/reasoning_item.py +44 -0
  118. agentlin_client-0.1.0/src/agentlin_client/types/conversations/reasoning_item_param.py +45 -0
  119. agentlin_client-0.1.0/src/agentlin_client/types/conversations/reasoning_text_content.py +15 -0
  120. agentlin_client-0.1.0/src/agentlin_client/types/conversations/reasoning_text_content_param.py +15 -0
  121. agentlin_client-0.1.0/src/agentlin_client/types/conversations/refusal_content.py +15 -0
  122. agentlin_client-0.1.0/src/agentlin_client/types/conversations/refusal_content_param.py +15 -0
  123. agentlin_client-0.1.0/src/agentlin_client/types/conversations/web_search_tool_call.py +67 -0
  124. agentlin_client-0.1.0/src/agentlin_client/types/conversations/web_search_tool_call_param.py +66 -0
  125. agentlin_client-0.1.0/src/agentlin_client/types/mcp_tool_filter.py +20 -0
  126. agentlin_client-0.1.0/src/agentlin_client/types/mcp_tool_filter_param.py +22 -0
  127. agentlin_client-0.1.0/src/agentlin_client/types/model_response_properties_standard.py +87 -0
  128. agentlin_client-0.1.0/src/agentlin_client/types/response.py +166 -0
  129. agentlin_client-0.1.0/src/agentlin_client/types/response_create_params.py +497 -0
  130. agentlin_client-0.1.0/src/agentlin_client/types/response_list_input_items_params.py +34 -0
  131. agentlin_client-0.1.0/src/agentlin_client/types/response_list_input_items_response.py +70 -0
  132. agentlin_client-0.1.0/src/agentlin_client/types/response_properties.py +328 -0
  133. agentlin_client-0.1.0/src/agentlin_client/types/response_retrieve_params.py +42 -0
  134. agentlin_client-0.1.0/src/agentlin_client/types/response_tool.py +495 -0
  135. agentlin_client-0.1.0/src/agentlin_client/types/response_tool_param.py +491 -0
  136. agentlin_client-0.1.0/src/agentlin_client/types/text_response_format_configuration.py +59 -0
  137. agentlin_client-0.1.0/src/agentlin_client/types/text_response_format_configuration_param.py +54 -0
  138. agentlin_client-0.1.0/tests/__init__.py +1 -0
  139. agentlin_client-0.1.0/tests/api_resources/__init__.py +1 -0
  140. agentlin_client-0.1.0/tests/api_resources/conversations/__init__.py +1 -0
  141. agentlin_client-0.1.0/tests/api_resources/conversations/test_items.py +536 -0
  142. agentlin_client-0.1.0/tests/api_resources/test_conversations.py +371 -0
  143. agentlin_client-0.1.0/tests/api_resources/test_responses.py +573 -0
  144. agentlin_client-0.1.0/tests/conftest.py +84 -0
  145. agentlin_client-0.1.0/tests/sample_file.txt +1 -0
  146. agentlin_client-0.1.0/tests/test_client.py +1677 -0
  147. agentlin_client-0.1.0/tests/test_deepcopy.py +58 -0
  148. agentlin_client-0.1.0/tests/test_extract_files.py +64 -0
  149. agentlin_client-0.1.0/tests/test_files.py +51 -0
  150. agentlin_client-0.1.0/tests/test_models.py +963 -0
  151. agentlin_client-0.1.0/tests/test_qs.py +78 -0
  152. agentlin_client-0.1.0/tests/test_required_args.py +111 -0
  153. agentlin_client-0.1.0/tests/test_response.py +277 -0
  154. agentlin_client-0.1.0/tests/test_streaming.py +248 -0
  155. agentlin_client-0.1.0/tests/test_transform.py +460 -0
  156. agentlin_client-0.1.0/tests/test_utils/test_datetime_parse.py +110 -0
  157. agentlin_client-0.1.0/tests/test_utils/test_proxy.py +34 -0
  158. agentlin_client-0.1.0/tests/test_utils/test_typing.py +73 -0
  159. agentlin_client-0.1.0/tests/utils.py +167 -0
@@ -0,0 +1,15 @@
1
+ .prism.log
2
+ _dev
3
+
4
+ __pycache__
5
+ .mypy_cache
6
+
7
+ dist
8
+
9
+ .venv
10
+ .idea
11
+
12
+ .env
13
+ .envrc
14
+ codegen.log
15
+ Brewfile.lock.json
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0"
3
+ }
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2025-10-15)
4
+
5
+ Full Changelog: [v0.0.1...v0.1.0](https://github.com/LinXueyuanStdio/agentlin-client-python/compare/v0.0.1...v0.1.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([5d62563](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/5d625637e111757cd1ce8b83988e99b3e6af4033))
10
+ * **api:** manual updates ([1d5cd77](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/1d5cd777fd00cef3e9677c5efdc700375b0ec9e6))
11
+ * **api:** manual updates ([07ab37d](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/07ab37d3ddd983ff06821b469ffb2e5235ae2f29))
12
+ * **api:** manual updates ([6ce99e2](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/6ce99e2d0df907c3e3173a3d751a0eb70801ba91))
13
+ * **api:** manual updates ([02588ab](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/02588ab897269c98a06ef46c8a276b3ecdf63bad))
14
+ * **api:** manual updates ([16e44a9](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/16e44a9d54ccfbe05760d9e089822bc5f698c767))
15
+ * **api:** manual updates ([f21e45f](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/f21e45f8d1b6d9ec32a636a05542635a78fdb360))
16
+ * **api:** manual updates ([553d47b](https://github.com/LinXueyuanStdio/agentlin-client-python/commit/553d47bee958c29a511c7161362a427d1f821840))
@@ -0,0 +1,128 @@
1
+ ## Setting up the environment
2
+
3
+ ### With Rye
4
+
5
+ We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
6
+
7
+ ```sh
8
+ $ ./scripts/bootstrap
9
+ ```
10
+
11
+ Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
12
+
13
+ ```sh
14
+ $ rye sync --all-features
15
+ ```
16
+
17
+ You can then run scripts using `rye run python script.py` or by activating the virtual environment:
18
+
19
+ ```sh
20
+ # Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
21
+ $ source .venv/bin/activate
22
+
23
+ # now you can omit the `rye run` prefix
24
+ $ python script.py
25
+ ```
26
+
27
+ ### Without Rye
28
+
29
+ Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
30
+
31
+ ```sh
32
+ $ pip install -r requirements-dev.lock
33
+ ```
34
+
35
+ ## Modifying/Adding code
36
+
37
+ Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
38
+ result in merge conflicts between manual patches and changes from the generator. The generator will never
39
+ modify the contents of the `src/agentlin_client/lib/` and `examples/` directories.
40
+
41
+ ## Adding and running examples
42
+
43
+ All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
44
+
45
+ ```py
46
+ # add an example to examples/<your-example>.py
47
+
48
+ #!/usr/bin/env -S rye run python
49
+
50
+ ```
51
+
52
+ ```sh
53
+ $ chmod +x examples/<your-example>.py
54
+ # run the example against your api
55
+ $ ./examples/<your-example>.py
56
+ ```
57
+
58
+ ## Using the repository from source
59
+
60
+ If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
61
+
62
+ To install via git:
63
+
64
+ ```sh
65
+ $ pip install git+ssh://git@github.com/LinXueyuanStdio/agentlin-client-python.git
66
+ ```
67
+
68
+ Alternatively, you can build from source and install the wheel file:
69
+
70
+ Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently.
71
+
72
+ To create a distributable version of the library, all you have to do is run this command:
73
+
74
+ ```sh
75
+ $ rye build
76
+ # or
77
+ $ python -m build
78
+ ```
79
+
80
+ Then to install:
81
+
82
+ ```sh
83
+ $ pip install ./path-to-wheel-file.whl
84
+ ```
85
+
86
+ ## Running tests
87
+
88
+ Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
89
+
90
+ ```sh
91
+ # you will need npm installed
92
+ $ npx prism mock path/to/your/openapi.yml
93
+ ```
94
+
95
+ ```sh
96
+ $ ./scripts/test
97
+ ```
98
+
99
+ ## Linting and formatting
100
+
101
+ This repository uses [ruff](https://github.com/astral-sh/ruff) and
102
+ [black](https://github.com/psf/black) to format the code in the repository.
103
+
104
+ To lint:
105
+
106
+ ```sh
107
+ $ ./scripts/lint
108
+ ```
109
+
110
+ To format and fix all ruff issues automatically:
111
+
112
+ ```sh
113
+ $ ./scripts/format
114
+ ```
115
+
116
+ ## Publishing and releases
117
+
118
+ Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
119
+ the changes aren't made through the automated pipeline, you may want to make releases manually.
120
+
121
+ ### Publish with a GitHub workflow
122
+
123
+ You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/LinXueyuanStdio/agentlin-client-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
124
+
125
+ ### Publish manually
126
+
127
+ If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
128
+ the environment.
@@ -0,0 +1,7 @@
1
+ Copyright 2025 client
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,429 @@
1
+ Metadata-Version: 2.3
2
+ Name: agentlin_client
3
+ Version: 0.1.0
4
+ Summary: The official Python library for the client API
5
+ Project-URL: Homepage, https://github.com/LinXueyuanStdio/agentlin-client-python
6
+ Project-URL: Repository, https://github.com/LinXueyuanStdio/agentlin-client-python
7
+ Author-email: Client <linxy59@mail2.sysu.edu.cn>
8
+ License: MIT
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.8
25
+ Requires-Dist: anyio<5,>=3.5.0
26
+ Requires-Dist: distro<2,>=1.7.0
27
+ Requires-Dist: httpx<1,>=0.23.0
28
+ Requires-Dist: pydantic<3,>=1.9.0
29
+ Requires-Dist: sniffio
30
+ Requires-Dist: typing-extensions<5,>=4.10
31
+ Provides-Extra: aiohttp
32
+ Requires-Dist: aiohttp; extra == 'aiohttp'
33
+ Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Client Python API library
37
+
38
+ <!-- prettier-ignore -->
39
+ [![PyPI version](https://img.shields.io/pypi/v/agentlin_client.svg?label=pypi%20(stable))](https://pypi.org/project/agentlin_client/)
40
+
41
+ The Client Python library provides convenient access to the Client REST API from any Python 3.8+
42
+ application. The library includes type definitions for all request params and response fields,
43
+ and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
44
+
45
+ It is generated with [Stainless](https://www.stainless.com/).
46
+
47
+ ## Documentation
48
+
49
+ The REST API documentation can be found on [help.openai.com](https://help.openai.com/). The full API of this library can be found in [api.md](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/api.md).
50
+
51
+ ## Installation
52
+
53
+ ```sh
54
+ # install from the production repo
55
+ pip install git+ssh://git@github.com/LinXueyuanStdio/agentlin-client-python.git
56
+ ```
57
+
58
+ > [!NOTE]
59
+ > Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install agentlin_client`
60
+
61
+ ## Usage
62
+
63
+ The full API of this library can be found in [api.md](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/api.md).
64
+
65
+ ```python
66
+ import os
67
+ from agentlin_client import Client
68
+
69
+ client = Client(
70
+ api_key=os.environ.get("AGENTLIN_API_KEY"), # This is the default and can be omitted
71
+ )
72
+
73
+ response = client.responses.create(
74
+ input="hello",
75
+ )
76
+ ```
77
+
78
+ While you can provide an `api_key` keyword argument,
79
+ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
80
+ to add `AGENTLIN_API_KEY="My API Key"` to your `.env` file
81
+ so that your API Key is not stored in source control.
82
+
83
+ ## Async usage
84
+
85
+ Simply import `AsyncClient` instead of `Client` and use `await` with each API call:
86
+
87
+ ```python
88
+ import os
89
+ import asyncio
90
+ from agentlin_client import AsyncClient
91
+
92
+ client = AsyncClient(
93
+ api_key=os.environ.get("AGENTLIN_API_KEY"), # This is the default and can be omitted
94
+ )
95
+
96
+
97
+ async def main() -> None:
98
+ response = await client.responses.create(
99
+ input="hello",
100
+ )
101
+
102
+
103
+ asyncio.run(main())
104
+ ```
105
+
106
+ Functionality between the synchronous and asynchronous clients is otherwise identical.
107
+
108
+ ### With aiohttp
109
+
110
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
111
+
112
+ You can enable this by installing `aiohttp`:
113
+
114
+ ```sh
115
+ # install from the production repo
116
+ pip install 'agentlin_client[aiohttp] @ git+ssh://git@github.com/LinXueyuanStdio/agentlin-client-python.git'
117
+ ```
118
+
119
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
120
+
121
+ ```python
122
+ import asyncio
123
+ from agentlin_client import DefaultAioHttpClient
124
+ from agentlin_client import AsyncClient
125
+
126
+
127
+ async def main() -> None:
128
+ async with AsyncClient(
129
+ api_key="My API Key",
130
+ http_client=DefaultAioHttpClient(),
131
+ ) as client:
132
+ response = await client.responses.create(
133
+ input="hello",
134
+ )
135
+
136
+
137
+ asyncio.run(main())
138
+ ```
139
+
140
+ ## Using types
141
+
142
+ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
143
+
144
+ - Serializing back into JSON, `model.to_json()`
145
+ - Converting to a dictionary, `model.to_dict()`
146
+
147
+ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
148
+
149
+ ## Nested params
150
+
151
+ Nested parameters are dictionaries, typed using `TypedDict`, for example:
152
+
153
+ ```python
154
+ from agentlin_client import Client
155
+
156
+ client = Client()
157
+
158
+ response = client.responses.create(
159
+ prompt={"id": "id"},
160
+ )
161
+ print(response.prompt)
162
+ ```
163
+
164
+ ## Handling errors
165
+
166
+ When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `agentlin_client.APIConnectionError` is raised.
167
+
168
+ When the API returns a non-success status code (that is, 4xx or 5xx
169
+ response), a subclass of `agentlin_client.APIStatusError` is raised, containing `status_code` and `response` properties.
170
+
171
+ All errors inherit from `agentlin_client.APIError`.
172
+
173
+ ```python
174
+ import agentlin_client
175
+ from agentlin_client import Client
176
+
177
+ client = Client()
178
+
179
+ try:
180
+ client.responses.create(
181
+ input="hello",
182
+ )
183
+ except agentlin_client.APIConnectionError as e:
184
+ print("The server could not be reached")
185
+ print(e.__cause__) # an underlying Exception, likely raised within httpx.
186
+ except agentlin_client.RateLimitError as e:
187
+ print("A 429 status code was received; we should back off a bit.")
188
+ except agentlin_client.APIStatusError as e:
189
+ print("Another non-200-range status code was received")
190
+ print(e.status_code)
191
+ print(e.response)
192
+ ```
193
+
194
+ Error codes are as follows:
195
+
196
+ | Status Code | Error Type |
197
+ | ----------- | -------------------------- |
198
+ | 400 | `BadRequestError` |
199
+ | 401 | `AuthenticationError` |
200
+ | 403 | `PermissionDeniedError` |
201
+ | 404 | `NotFoundError` |
202
+ | 422 | `UnprocessableEntityError` |
203
+ | 429 | `RateLimitError` |
204
+ | >=500 | `InternalServerError` |
205
+ | N/A | `APIConnectionError` |
206
+
207
+ ### Retries
208
+
209
+ Certain errors are automatically retried 2 times by default, with a short exponential backoff.
210
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
211
+ 429 Rate Limit, and >=500 Internal errors are all retried by default.
212
+
213
+ You can use the `max_retries` option to configure or disable retry settings:
214
+
215
+ ```python
216
+ from agentlin_client import Client
217
+
218
+ # Configure the default for all requests:
219
+ client = Client(
220
+ # default is 2
221
+ max_retries=0,
222
+ )
223
+
224
+ # Or, configure per-request:
225
+ client.with_options(max_retries=5).responses.create(
226
+ input="hello",
227
+ )
228
+ ```
229
+
230
+ ### Timeouts
231
+
232
+ By default requests time out after 1 minute. You can configure this with a `timeout` option,
233
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
234
+
235
+ ```python
236
+ from agentlin_client import Client
237
+
238
+ # Configure the default for all requests:
239
+ client = Client(
240
+ # 20 seconds (default is 1 minute)
241
+ timeout=20.0,
242
+ )
243
+
244
+ # More granular control:
245
+ client = Client(
246
+ timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
247
+ )
248
+
249
+ # Override per-request:
250
+ client.with_options(timeout=5.0).responses.create(
251
+ input="hello",
252
+ )
253
+ ```
254
+
255
+ On timeout, an `APITimeoutError` is thrown.
256
+
257
+ Note that requests that time out are [retried twice by default](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/#retries).
258
+
259
+ ## Advanced
260
+
261
+ ### Logging
262
+
263
+ We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
264
+
265
+ You can enable logging by setting the environment variable `CLIENT_LOG` to `info`.
266
+
267
+ ```shell
268
+ $ export CLIENT_LOG=info
269
+ ```
270
+
271
+ Or to `debug` for more verbose logging.
272
+
273
+ ### How to tell whether `None` means `null` or missing
274
+
275
+ In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
276
+
277
+ ```py
278
+ if response.my_field is None:
279
+ if 'my_field' not in response.model_fields_set:
280
+ print('Got json like {}, without a "my_field" key present at all.')
281
+ else:
282
+ print('Got json like {"my_field": null}.')
283
+ ```
284
+
285
+ ### Accessing raw response data (e.g. headers)
286
+
287
+ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
288
+
289
+ ```py
290
+ from agentlin_client import Client
291
+
292
+ client = Client()
293
+ response = client.responses.with_raw_response.create(
294
+ input="hello",
295
+ )
296
+ print(response.headers.get('X-My-Header'))
297
+
298
+ response = response.parse() # get the object that `responses.create()` would have returned
299
+ print(response)
300
+ ```
301
+
302
+ These methods return an [`APIResponse`](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/src/agentlin_client/_response.py) object.
303
+
304
+ The async client returns an [`AsyncAPIResponse`](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/src/agentlin_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
305
+
306
+ #### `.with_streaming_response`
307
+
308
+ The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
309
+
310
+ To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
311
+
312
+ ```python
313
+ with client.responses.with_streaming_response.create(
314
+ input="hello",
315
+ ) as response:
316
+ print(response.headers.get("X-My-Header"))
317
+
318
+ for line in response.iter_lines():
319
+ print(line)
320
+ ```
321
+
322
+ The context manager is required so that the response will reliably be closed.
323
+
324
+ ### Making custom/undocumented requests
325
+
326
+ This library is typed for convenient access to the documented API.
327
+
328
+ If you need to access undocumented endpoints, params, or response properties, the library can still be used.
329
+
330
+ #### Undocumented endpoints
331
+
332
+ To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
333
+ http verbs. Options on the client will be respected (such as retries) when making this request.
334
+
335
+ ```py
336
+ import httpx
337
+
338
+ response = client.post(
339
+ "/foo",
340
+ cast_to=httpx.Response,
341
+ body={"my_param": True},
342
+ )
343
+
344
+ print(response.headers.get("x-foo"))
345
+ ```
346
+
347
+ #### Undocumented request params
348
+
349
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
350
+ options.
351
+
352
+ #### Undocumented response properties
353
+
354
+ To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
355
+ can also get all the extra fields on the Pydantic model as a dict with
356
+ [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
357
+
358
+ ### Configuring the HTTP client
359
+
360
+ You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
361
+
362
+ - Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
363
+ - Custom [transports](https://www.python-httpx.org/advanced/transports/)
364
+ - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
365
+
366
+ ```python
367
+ import httpx
368
+ from agentlin_client import Client, DefaultHttpxClient
369
+
370
+ client = Client(
371
+ # Or use the `CLIENT_BASE_URL` env var
372
+ base_url="http://my.test.server.example.com:8083",
373
+ http_client=DefaultHttpxClient(
374
+ proxy="http://my.test.proxy.example.com",
375
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
376
+ ),
377
+ )
378
+ ```
379
+
380
+ You can also customize the client on a per-request basis by using `with_options()`:
381
+
382
+ ```python
383
+ client.with_options(http_client=DefaultHttpxClient(...))
384
+ ```
385
+
386
+ ### Managing HTTP resources
387
+
388
+ By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
389
+
390
+ ```py
391
+ from agentlin_client import Client
392
+
393
+ with Client() as client:
394
+ # make requests here
395
+ ...
396
+
397
+ # HTTP client is now closed
398
+ ```
399
+
400
+ ## Versioning
401
+
402
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
403
+
404
+ 1. Changes that only affect static types, without breaking runtime behavior.
405
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
406
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
407
+
408
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
409
+
410
+ We are keen for your feedback; please open an [issue](https://www.github.com/LinXueyuanStdio/agentlin-client-python/issues) with questions, bugs, or suggestions.
411
+
412
+ ### Determining the installed version
413
+
414
+ If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
415
+
416
+ You can determine the version that is being used at runtime with:
417
+
418
+ ```py
419
+ import agentlin_client
420
+ print(agentlin_client.__version__)
421
+ ```
422
+
423
+ ## Requirements
424
+
425
+ Python 3.8 or higher.
426
+
427
+ ## Contributing
428
+
429
+ See [the contributing documentation](https://github.com/LinXueyuanStdio/agentlin-client-python/tree/main/./CONTRIBUTING.md).