Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions docs/api-reference/core/Codebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,41 +87,6 @@ import {Attribute} from '/snippets/Attribute.mdx';

## Methods
<HorizontalDivider />
### <span className="text-primary">ai</span>
Generates a response from the AI based on the provided prompt, target, and context.
<GithubLinkNote link="https://github.com/codegen-sh/graph-sitter/blob/develop/src/graph_sitter/core/codebase.py#L1196-L1283" />

<ParameterWrapper>
<Parameter
name="prompt"
type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> }
description="The text prompt to send to the AI."
defaultValue=""
/>
<Parameter
name="target"
type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| None</span></> }
description="An optional editable object (like a function, class, etc.) that provides the main focus for the AI's response."
defaultValue="None"
/>
<Parameter
name="context"
type={ <><a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>] | dict[str,</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>| list[</span> <a href="/api-reference/core/Editable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Editable</a> <span>]] | None</span></> }
description="Additional context to help inform the AI's response."
defaultValue="None"
/>
<Parameter
name="model"
type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> }
description="The AI model to use for generating the response. Defaults to &quot;gpt-4o&quot;."
defaultValue="&quot;gpt-4o&quot;"
/>
</ParameterWrapper>


<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The generated response from the AI."/>


### <span className="text-primary">checkout</span>
Checks out a git branch or commit and syncs the codebase graph to the new state.
<GithubLinkNote link="https://github.com/codegen-sh/graph-sitter/blob/develop/src/graph_sitter/core/codebase.py#L865-L909" />
Expand Down Expand Up @@ -622,14 +587,6 @@ Resets the codebase by
<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/>


### <span className="text-primary">set_ai_key</span>
Sets the OpenAI key for the current Codebase instance.
<GithubLinkNote link="https://github.com/codegen-sh/graph-sitter/blob/develop/src/graph_sitter/core/codebase.py#L1285-L1291" />


<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/>


### <span className="text-primary">set_session_options</span>
Sets the session options for the current codebase.
<GithubLinkNote link="https://github.com/codegen-sh/graph-sitter/blob/develop/src/graph_sitter/core/codebase.py#L1310-L1328" />
Expand All @@ -647,12 +604,6 @@ Sets the session options for the current codebase.
description="The maximum duration in seconds for a session"
defaultValue=""
/>
<Parameter
name="max_ai_requests"
type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">int, optional</code> }
description="The maximum number of AI requests"
defaultValue=""
/>
</ParameterWrapper>


Expand Down Expand Up @@ -699,4 +650,3 @@ Visualizes a NetworkX graph or Plotly figure.
<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/>



218 changes: 0 additions & 218 deletions docs/api-reference/openapi3.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,160 +165,6 @@
}
}
},
"/v1/organizations/{org_id}/agent/run": {
"post": {
"tags": ["agents", "agents", "agents"],
"summary": "Create Agent Run",
"description": "Create a new agent run.\n\nCreates and initiates a long-running agent process based on the provided prompt.\nThe process will complete asynchronously, and the response contains the agent run ID\nwhich can be used to check the status later. The requesting user must be a member\nof the specified organization.\n\nRate limit: 10 requests per minute.",
"operationId": "create_agent_run_v1_organizations__org_id__agent_run_post",
"parameters": [
{
"name": "org_id",
"in": "path",
"required": true,
"schema": { "type": "integer", "title": "Org Id" }
},
{
"name": "authorization",
"in": "header",
"required": false,
"schema": { "title": "Authorization" }
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/CreateAgentRunInput" }
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/AgentRunResponse" }
}
}
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIRateLimitErrorResponse"
}
}
},
"description": "Too Many Requests"
},
"402": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentRunLimitReachedErrorResponse"
}
}
},
"description": "Payment Required"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PermissionsErrorResponse"
}
}
},
"description": "Forbidden"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
}
}
}
}
}
},
"/v1/organizations/{org_id}/agent/run/{agent_run_id}": {
"get": {
"tags": ["agents", "agents", "agents"],
"summary": "Get Agent Run",
"description": "Retrieve the status and result of an agent run.\n\nReturns the current status, progress, and any available results for the specified agent run.\nThe agent run must belong to the specified organization. If the agent run is still in progress,\nthis endpoint can be polled to check for completion.\n\nRate limit: 60 requests per 30 seconds.",
"operationId": "get_agent_run_v1_organizations__org_id__agent_run__agent_run_id__get",
"parameters": [
{
"name": "agent_run_id",
"in": "path",
"required": true,
"schema": { "type": "integer", "title": "Agent Run Id" }
},
{
"name": "org_id",
"in": "path",
"required": true,
"schema": { "type": "integer", "title": "Org Id" }
},
{
"name": "authorization",
"in": "header",
"required": false,
"schema": { "title": "Authorization" }
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/AgentRunResponse" }
}
}
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIRateLimitErrorResponse"
}
}
},
"description": "Too Many Requests"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PermissionsErrorResponse"
}
}
},
"description": "Forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentRunNotFoundErrorResponse"
}
}
},
"description": "Not Found"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
}
}
}
}
}
},
"/v1/organizations": {
"get": {
"tags": ["organizations", "organizations", "organizations"],
Expand Down Expand Up @@ -407,70 +253,6 @@
"type": "object",
"title": "APIRateLimitErrorResponse"
},
"AgentRunLimitReachedErrorResponse": {
"properties": {
"message": {
"type": "string",
"title": "Message",
"default": "Alloted agent runs for the current billing plan have been reached. Please upgrade your plan to continue."
},
"status_code": {
"type": "integer",
"title": "Status Code",
"default": 402
}
},
"type": "object",
"title": "AgentRunLimitReachedErrorResponse"
},
"AgentRunNotFoundErrorResponse": {
"properties": {
"message": {
"type": "string",
"title": "Message",
"default": "Agent run not found."
},
"status_code": {
"type": "integer",
"title": "Status Code",
"default": 404
}
},
"type": "object",
"title": "AgentRunNotFoundErrorResponse"
},
"AgentRunResponse": {
"properties": {
"id": { "type": "integer", "title": "Id" },
"organization_id": { "type": "integer", "title": "Organization Id" },
"status": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Status"
},
"created_at": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Created At"
},
"web_url": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Web Url"
},
"result": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Result"
}
},
"type": "object",
"required": ["id", "organization_id"],
"title": "AgentRunResponse",
"description": "Represents an agent run in API responses"
},
"CreateAgentRunInput": {
"properties": { "prompt": { "type": "string", "title": "Prompt" } },
"type": "object",
"required": ["prompt"],
"title": "CreateAgentRunInput"
},
"HTTPValidationError": {
"properties": {
"detail": {
Expand Down
6 changes: 1 addition & 5 deletions docs/building-with-graph-sitter/codegen-with-wsl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,9 @@ To use WSL with VSCode:

You can read more about Developing in WSL [here](https://code.visualstudio.com/docs/remote/wsl).

<Tip>
If you plan on using Codegen's MCP (Model Context Protocol) or LSP (Language Server Protocol) features, running VSCode through WSL is highly recommended.
</Tip>

## Troubleshooting

- **I have trouble connecting to MCP or LSP from VSCode**: Windows and WSL run on two different network environments. WSL does come with a compatibility layer called [NAT (Network Address Translation)](https://learn.microsoft.com/en-us/windows/wsl/networking#default-networking-mode-nat) as a translation layer between the two environments, but it can sometimes cause issues. On machines running Windows 11 22H2 and higher, try switching to [Mirrored mode networking](https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking) to see if that fixes the issue.
- **I have trouble connecting development tools from VSCode**: Windows and WSL run on two different network environments. WSL does come with a compatibility layer called [NAT (Network Address Translation)](https://learn.microsoft.com/en-us/windows/wsl/networking#default-networking-mode-nat) as a translation layer between the two environments, but it can sometimes cause issues. On machines running Windows 11 22H2 and higher, try switching to [Mirrored mode networking](https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking) to see if that fixes the issue.
- **WSL takes up too much memory after running Codegen**: This is a known issue with WSL. Memory does not get properly released after running a memory-intensive process like Codegen. Try killing the WSL process using `wsl --shutdown` to free up memory. ([GitHub Issue for WSL](https://github.com/microsoft/WSL/issues/4166))
- **WSL hangs and pins the CPU at 100% when I try to run Codegen**: This could be because of WSL running out of memory. Try killing the WSL process using `wsl --shutdown` and then try running Graph-sitter again. If that doesn't work, try [downloading more RAM](https://downloadmoreram.com/).

Expand Down
29 changes: 2 additions & 27 deletions docs/building-with-graph-sitter/comments-and-docstrings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ for file in codebase.files:
indentation and maintains the existing comment style.
</Note>

## Special APIs and AI Integration
## Special APIs

### Google Style Docstrings

Expand All @@ -160,31 +160,6 @@ func_b = symbol_a.get_method("funcB")
func_b.docstring.to_google_docstring(func_b)
```

### Using AI for Documentation

Graph-sitter integrates with LLMs to help generate and improve documentation. You can use the [Codebase.ai(...)](/api-reference/core/Codebase#ai) method to:

- Generate comprehensive docstrings
- Update existing documentation
- Convert between documentation styles
- Add parameter descriptions

```python
# Generate a docstring using AI
function = codebase.get_function("my_function")

new_docstring = codebase.ai(
"Generate a comprehensive docstring in Google style",
target=function
context={
# provide additional context to the LLM
'usages': function.usages,
'dependencies': function.dependencies
}
)
function.set_docstring(new_docstring)
```

### Documentation Coverage

You can analyze and improve documentation coverage across your codebase:
Expand All @@ -200,4 +175,4 @@ for function in codebase.functions:

coverage = (documented / total * 100) if total > 0 else 0
print(f"Documentation coverage: {coverage:.1f}%")
```
```
Loading