gitcode_api.llm.openai

OpenAI tool adapter for the GitCode SDK.

Classes

GitCodeOpenAITool([async_mode, indent, ...])

OpenAI-compatible callable tool for invoking GitCode SDK resources.

class GitCodeOpenAITool(async_mode: bool = False, indent: int = 2, *, client: GitCode | None = None, async_client: AsyncGitCode | None = None, api_key: str | None = None, base_url: str = 'https://api.gitcode.com/api/v5', timeout: float | None = None, decrypt: Callable | None = None, owner: str | None = None, repo: str | None = None)

Bases: GitCodeLLMTool

OpenAI-compatible callable tool for invoking GitCode SDK resources.

Parameters:
  • async_mode – When true, calling the instance returns the async tool coroutine.

  • indentindent argument passed to json.dumps() when serializing invocation results (default 2).

  • client – Optional synchronous GitCode client.

  • async_client – Optional asynchronous GitCode client.

  • api_key – Personal access token used when clients are not supplied.

  • base_url – Base URL for generated clients.

  • timeout – Request timeout for generated clients.

  • decrypt – Optional decryption function for encrypted access tokens.

  • owner – Default repository owner for generated clients.

  • repo – Default repository name for generated clients.

Create an OpenAI tool wrapper.

property tool: Dict[str, Any]

Return this tool in OpenAI Chat Completions tool format.

to_dict() Dict[str, Any]

Return this tool in OpenAI Chat Completions tool format.