gitcode-api 1.2.10__py3-none-any.whl → 1.2.11__py3-none-any.whl

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.
@@ -3,6 +3,8 @@
3
3
  from importlib import import_module
4
4
  from typing import TYPE_CHECKING, Any, Dict
5
5
 
6
+ from ._tool import GitCodeLLMTool
7
+
6
8
  if TYPE_CHECKING:
7
9
  from .jiuwen import create_openjiuwen_gitcode_api_tool
8
10
  from .mcp import (
@@ -25,7 +27,7 @@ _IMPORT_MAP = {
25
27
  "create_openjiuwen_gitcode_api_tool": ".jiuwen",
26
28
  }
27
29
 
28
- _IMPORT_CACHE: Dict[str, Any] = {}
30
+ _IMPORT_CACHE: Dict[str, Any] = {"GitCodeLLMTool": GitCodeLLMTool}
29
31
 
30
32
 
31
33
  def __getattr__(name: str) -> object:
@@ -50,6 +52,7 @@ def __dir__() -> list[str]:
50
52
 
51
53
 
52
54
  __all__ = [
55
+ "GitCodeLLMTool",
53
56
  "GitCodeOpenAITool",
54
57
  "GitCodeMCP",
55
58
  "create_mcp_gitcode_api_tool",
gitcode_api/llm/_tool.py CHANGED
@@ -227,11 +227,11 @@ class GitCodeLLMTool:
227
227
  :param client: Optional synchronous GitCode client.
228
228
  :param async_client: Optional asynchronous GitCode client.
229
229
  :param api_key: Personal access token used when clients are not supplied.
230
- :param owner: Default repository owner for generated clients.
231
- :param repo: Default repository name for generated clients.
232
230
  :param base_url: Base URL for generated clients.
233
231
  :param timeout: Request timeout for generated clients.
234
232
  :param decrypt: Optional decryption function for encrypted access tokens.
233
+ :param owner: Default repository owner for generated clients.
234
+ :param repo: Default repository name for generated clients.
235
235
  """
236
236
 
237
237
  def __init__(
@@ -240,11 +240,11 @@ class GitCodeLLMTool:
240
240
  client: Optional[GitCode] = None,
241
241
  async_client: Optional[AsyncGitCode] = None,
242
242
  api_key: Optional[str] = None,
243
- owner: Optional[str] = None,
244
- repo: Optional[str] = None,
245
243
  base_url: str = DEFAULT_BASE_URL,
246
244
  timeout: Optional[float] = None,
247
245
  decrypt: Optional[Callable] = None,
246
+ owner: Optional[str] = None,
247
+ repo: Optional[str] = None,
248
248
  ) -> None:
249
249
  """Create a reusable tool with lazy sync and async clients."""
250
250
  self._client = client
gitcode_api/llm/jiuwen.py CHANGED
@@ -30,8 +30,30 @@ def _openjiuwen_tool_decorator() -> Callable[..., Any]:
30
30
  class _GitCodeJiuwenTool(GitCodeLLMTool):
31
31
  """Build an openJiuwen ``LocalFunction`` bound to :class:`GitCodeLLMTool` (async invoke only)."""
32
32
 
33
- def __init__(self, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs) -> None:
34
- super().__init__(**kwargs)
33
+ def __init__(
34
+ self,
35
+ *,
36
+ name: Optional[str] = None,
37
+ description: Optional[str] = None,
38
+ client: Optional[GitCode] = None,
39
+ async_client: Optional[AsyncGitCode] = None,
40
+ api_key: Optional[str] = None,
41
+ base_url: str = DEFAULT_BASE_URL,
42
+ timeout: Optional[float] = None,
43
+ decrypt: Optional[Callable[..., Any]] = None,
44
+ owner: Optional[str] = None,
45
+ repo: Optional[str] = None,
46
+ ) -> None:
47
+ super().__init__(
48
+ client=client,
49
+ async_client=async_client,
50
+ api_key=api_key,
51
+ owner=owner,
52
+ repo=repo,
53
+ base_url=base_url,
54
+ timeout=timeout,
55
+ decrypt=decrypt,
56
+ )
35
57
  tool_name = name if name is not None else TOOL_NAME
36
58
  tool_description = description if description is not None else TOOL_DESCRIPTION
37
59
  oj_tool = _openjiuwen_tool_decorator()
@@ -60,11 +82,11 @@ def create_openjiuwen_gitcode_api_tool(
60
82
  client: Optional[GitCode] = None,
61
83
  async_client: Optional[AsyncGitCode] = None,
62
84
  api_key: Optional[str] = None,
63
- owner: Optional[str] = None,
64
- repo: Optional[str] = None,
65
85
  base_url: str = DEFAULT_BASE_URL,
66
86
  timeout: Optional[float] = None,
67
87
  decrypt: Optional[Callable[..., Any]] = None,
88
+ owner: Optional[str] = None,
89
+ repo: Optional[str] = None,
68
90
  ) -> "LocalFunction":
69
91
  """Create an openJiuwen ``LocalFunction`` for the GitCode API tool.
70
92
 
@@ -73,11 +95,11 @@ def create_openjiuwen_gitcode_api_tool(
73
95
  :param client: Optional synchronous GitCode client.
74
96
  :param async_client: Optional asynchronous GitCode client.
75
97
  :param api_key: Personal access token when clients are not supplied.
76
- :param owner: Default repository owner for generated clients.
77
- :param repo: Default repository name for generated clients.
78
98
  :param base_url: Base URL for generated clients.
79
99
  :param timeout: Request timeout for generated clients.
80
100
  :param decrypt: Optional decryption function for encrypted access tokens.
101
+ :param owner: Default repository owner for generated clients.
102
+ :param repo: Default repository name for generated clients.
81
103
  :returns: openJiuwen ``LocalFunction`` with the standard parameter schema.
82
104
  """
83
105
  adapter = _GitCodeJiuwenTool(
gitcode_api/llm/openai.py CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  import json
4
4
  from functools import cached_property
5
- from typing import Any, Coroutine, Dict, Union
5
+ from typing import Any, Callable, Coroutine, Dict, Optional, Union
6
+
7
+ from gitcode_api import AsyncGitCode, GitCode
8
+ from gitcode_api._base_client import DEFAULT_BASE_URL
6
9
 
7
10
  from ._tool import TOOL_DESCRIPTION, TOOL_NAME, TOOL_PARAMETERS, GitCodeLLMTool
8
11
 
@@ -13,19 +16,47 @@ class GitCodeOpenAITool(GitCodeLLMTool):
13
16
  :param async_mode: When true, calling the instance returns the async tool coroutine.
14
17
  :param indent: ``indent`` argument passed to :func:`json.dumps` when serializing
15
18
  invocation results (default ``2``).
16
- :param kwargs: Passed to :class:`gitcode_api.llm.GitCodeLLMTool` ---
17
- ``client``, ``async_client``, ``api_key``, ``owner``, ``repo``, ``base_url``, ``timeout``, ``decrypt``.
19
+ :param client: Optional synchronous GitCode client.
20
+ :param async_client: Optional asynchronous GitCode client.
21
+ :param api_key: Personal access token used when clients are not supplied.
22
+ :param base_url: Base URL for generated clients.
23
+ :param timeout: Request timeout for generated clients.
24
+ :param decrypt: Optional decryption function for encrypted access tokens.
25
+ :param owner: Default repository owner for generated clients.
26
+ :param repo: Default repository name for generated clients.
18
27
  """
19
28
 
20
29
  name = TOOL_NAME
21
30
  description = TOOL_DESCRIPTION
22
31
  parameters = TOOL_PARAMETERS
23
32
 
24
- def __init__(self, async_mode: bool = False, indent: int = 2, **kwargs) -> None:
33
+ def __init__(
34
+ self,
35
+ async_mode: bool = False,
36
+ indent: int = 2,
37
+ *,
38
+ client: Optional[GitCode] = None,
39
+ async_client: Optional[AsyncGitCode] = None,
40
+ api_key: Optional[str] = None,
41
+ base_url: str = DEFAULT_BASE_URL,
42
+ timeout: Optional[float] = None,
43
+ decrypt: Optional[Callable] = None,
44
+ owner: Optional[str] = None,
45
+ repo: Optional[str] = None,
46
+ ) -> None:
25
47
  """Create an OpenAI tool wrapper."""
26
48
  self.indent = indent
27
49
  self.async_mode = bool(async_mode)
28
- super().__init__(**kwargs)
50
+ super().__init__(
51
+ client=client,
52
+ async_client=async_client,
53
+ api_key=api_key,
54
+ owner=owner,
55
+ repo=repo,
56
+ base_url=base_url,
57
+ timeout=timeout,
58
+ decrypt=decrypt,
59
+ )
29
60
 
30
61
  @cached_property
31
62
  def tool(self) -> Dict[str, Any]:
gitcode_api/version.txt CHANGED
@@ -1 +1 @@
1
- 1.2.10
1
+ 1.2.11
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-api
3
- Version: 1.2.10
3
+ Version: 1.2.11
4
4
  Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP, OpenAI tool, and openJiuwen tool) for agents. Community-maintained.
5
5
  Author-email: Hugo Huang <hugo@hugohuang.com>
6
6
  License-Expression: MIT
@@ -231,7 +231,7 @@ Every resource group inherits a cached `methods` property from the shared resour
231
231
 
232
232
  ## LLM tools, MCP, and openJiuwen
233
233
 
234
- The `gitcode_api.llm` module exposes a single logical tool, **`gitcode_api_tool`**, that routes calls to sync or async SDK resources. Model-facing parameters match the JSON schema used by OpenAI-style function tools:
234
+ The `gitcode_api.llm` module exposes a single unified tool, **`gitcode_api_tool`**, that routes calls to respective sync or async SDK resource groups. Model-facing parameters match the JSON schema used by OpenAI-style function tools:
235
235
 
236
236
  | Parameter | Role |
237
237
  | --- | --- |
@@ -9,21 +9,21 @@ gitcode_api/_models.py,sha256=v-GZzCGAb3_frY6wFiQww9m271U5MigivpEHDHnoDcI,109030
9
9
  gitcode_api/cli.py,sha256=7LLDRCKJg7avaLgIwckZZC5LewSpMPWNQFFDRhAQkEs,16616
10
10
  gitcode_api/py.typed,sha256=mDShSrm8qg9qjacQc2F-rI8ATllqP6EdgHuEYxuCXZ0,7
11
11
  gitcode_api/run_mcp.py,sha256=a7zNrcAooGovzokJwTHQGj6iT4g7iltaUoD_E1KLvMg,130
12
- gitcode_api/version.txt,sha256=QwQnXzDgdsdqvcDygPD91VN_GscAlTuhkI4ppk1TGRk,7
13
- gitcode_api/llm/__init__.py,sha256=7xD9jHpk0eE12J8SQ3G0SB-8A0wEUoAsdx6SOBW6OUI,1604
14
- gitcode_api/llm/_tool.py,sha256=mBQPYzQ-SuSWgumapcjv3pjGQfcPYt-IxUXBT5un2Lk,16239
15
- gitcode_api/llm/jiuwen.py,sha256=lR3uhW67ER2KdalK9NNCOVtqFFQ1o4N5ylzWM1LkA1o,3638
12
+ gitcode_api/version.txt,sha256=NzEMfzSBZRIsy59KhUwpSFOVuzrwZZulp3vgZsFRFnk,7
13
+ gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
14
+ gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
15
+ gitcode_api/llm/jiuwen.py,sha256=axwAcoG86XkPkN37PTh47Cdzwh3yACUpe4bTjlaAFDc,4244
16
16
  gitcode_api/llm/mcp.py,sha256=eeAuEETZ4THw31wbcnQaTlZQJ-9ZolvsejQY630OqHs,5702
17
- gitcode_api/llm/openai.py,sha256=cie6qmS3YzT4j-KelBgi0MNr6Cedh2uBPib8Bpje59M,2148
17
+ gitcode_api/llm/openai.py,sha256=r8LZi3oK9D80dfiPpv1TpP-PwKUXpAGqgNGE3hOIAaA,3200
18
18
  gitcode_api/resources/__init__.py,sha256=nsCKW0bFDZ5ombJZxLThmO82sOuF7o4OKUMRkAmwbwk,1725
19
19
  gitcode_api/resources/_shared.py,sha256=7bCym8bIfs818SiYYrBGI7-ZtiYlxECSDG3RduInu10,5387
20
20
  gitcode_api/resources/account.py,sha256=mnc2p7wI-nBnHFNdWPNiHfmZpT6d3RDQC777gewtm4M,38801
21
21
  gitcode_api/resources/collaboration.py,sha256=8lyk78GTjVXddiE9fieutsMGovRjteGfTJcAhwLoR0M,101607
22
22
  gitcode_api/resources/misc.py,sha256=guDwh4cxbTVsSa7EivaYM3bKMJ8_Op4KucGbKEoayKE,22412
23
23
  gitcode_api/resources/repositories.py,sha256=EAK2znZhEsgVUu-NDEQslSEEYJzvb-kHuh4mW57y6sc,78178
24
- gitcode_api-1.2.10.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
25
- gitcode_api-1.2.10.dist-info/METADATA,sha256=-RsrbiBw8GpiKvLmbmA42hJ7k45Rw6OlFdlq8n94oPc,22037
26
- gitcode_api-1.2.10.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
27
- gitcode_api-1.2.10.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
28
- gitcode_api-1.2.10.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
29
- gitcode_api-1.2.10.dist-info/RECORD,,
24
+ gitcode_api-1.2.11.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
25
+ gitcode_api-1.2.11.dist-info/METADATA,sha256=3VOsMVB8v0K7pMtOetkpLGH4UJjeF9R_QsEmF9GbZrs,22054
26
+ gitcode_api-1.2.11.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
27
+ gitcode_api-1.2.11.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
28
+ gitcode_api-1.2.11.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
29
+ gitcode_api-1.2.11.dist-info/RECORD,,