summaryrefslogtreecommitdiff
path: root/continuedev/src
diff options
context:
space:
mode:
Diffstat (limited to 'continuedev/src')
-rw-r--r--continuedev/src/continuedev/models/reference/test.py23
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/diff.py14
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/filetree.py6
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/github.py13
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/google.py12
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/search.py9
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/terminal.py10
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/url.py20
8 files changed, 74 insertions, 33 deletions
diff --git a/continuedev/src/continuedev/models/reference/test.py b/continuedev/src/continuedev/models/reference/test.py
index 58cfc3fe..1c7608ec 100644
--- a/continuedev/src/continuedev/models/reference/test.py
+++ b/continuedev/src/continuedev/models/reference/test.py
@@ -44,7 +44,7 @@ def import_context_provider_module(module_name, module_title):
return obj
-def docs_from_schema(schema, filename, ignore_properties=[], inherited=[]):
+def docs_from_schema(schema, filepath, ignore_properties=[], inherited=[]):
# Generate markdown docs
properties = ""
inherited_properties = ""
@@ -78,7 +78,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
{dedent(schema.get("description", ""))}
-[View the source](https://github.com/continuedev/continue/tree/main/continuedev/src/continuedev/libs/llm/{filename}.py)
+[View the source](https://github.com/continuedev/continue/tree/main/continuedev/src/continuedev/{filepath})
## Properties
@@ -91,30 +91,36 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
llm_module = importlib.import_module("continuedev.src.continuedev.libs.llm")
-llm_obj = getattr(llm_module, "LLM")
-schema = llm_obj.schema()
-llm_properties = schema["properties"].keys()
+ctx_obj = getattr(llm_module, "LLM")
+schema = ctx_obj.schema()
+ctx_properties = schema["properties"].keys()
for module_name, module_title in LLM_MODULES:
obj = import_llm_module(module_name, module_title)
schema = obj.schema()
- markdown_docs = docs_from_schema(schema, module_name, inherited=llm_properties)
+ markdown_docs = docs_from_schema(
+ schema, f"libs/llm/{module_name}.py", inherited=ctx_properties
+ )
with open(f"docs/docs/reference/Models/{module_name}.md", "w") as f:
f.write(markdown_docs)
config_module = importlib.import_module("continuedev.src.continuedev.core.config")
config_obj = getattr(config_module, "ContinueConfig")
schema = config_obj.schema()
-markdown_docs = docs_from_schema(schema, "config")
+markdown_docs = docs_from_schema(schema, "core/config.py")
with open("docs/docs/reference/config.md", "w") as f:
f.write(markdown_docs)
+ctx_module = importlib.import_module("continuedev.src.continuedev.core.context")
+ctx_obj = getattr(ctx_module, "ContextProvider")
+schema = ctx_obj.schema()
+ctx_properties = schema["properties"].keys()
for module_name, module_title in CONTEXT_PROVIDER_MODULES:
obj = import_context_provider_module(module_name, module_title)
schema = obj.schema()
markdown_docs = docs_from_schema(
schema,
- module_name,
+ f"plugins/context_providers/{module_name}.py",
ignore_properties=[
"sdk",
"updated_documents",
@@ -122,6 +128,7 @@ for module_name, module_title in CONTEXT_PROVIDER_MODULES:
"selected_items",
"ignore_patterns",
],
+ inherited=ctx_properties,
)
with open(f"docs/docs/reference/Context Providers/{module_name}.md", "w") as f:
f.write(markdown_docs)
diff --git a/continuedev/src/continuedev/plugins/context_providers/diff.py b/continuedev/src/continuedev/plugins/context_providers/diff.py
index 4c16cabf..157cbc33 100644
--- a/continuedev/src/continuedev/plugins/context_providers/diff.py
+++ b/continuedev/src/continuedev/plugins/context_providers/diff.py
@@ -1,19 +1,27 @@
import subprocess
from typing import List
+from pydantic import Field
+
from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
class DiffContextProvider(ContextProvider):
+ """
+ Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
+ """
+
title = "diff"
display_title = "Diff"
description = "Output of 'git diff' in current repo"
dynamic = True
- DIFF_CONTEXT_ITEM_ID = "diff"
+ _DIFF_CONTEXT_ITEM_ID = "diff"
- workspace_dir: str = None
+ workspace_dir: str = Field(
+ None, description="The workspace directory in which to run `git diff`"
+ )
@property
def BASE_CONTEXT_ITEM(self):
@@ -23,7 +31,7 @@ class DiffContextProvider(ContextProvider):
name="Diff",
description="Reference the output of 'git diff' for the current workspace",
id=ContextItemId(
- provider_title=self.title, item_id=self.DIFF_CONTEXT_ITEM_ID
+ provider_title=self.title, item_id=self._DIFF_CONTEXT_ITEM_ID
),
),
)
diff --git a/continuedev/src/continuedev/plugins/context_providers/filetree.py b/continuedev/src/continuedev/plugins/context_providers/filetree.py
index 968b761d..5b3d3a50 100644
--- a/continuedev/src/continuedev/plugins/context_providers/filetree.py
+++ b/continuedev/src/continuedev/plugins/context_providers/filetree.py
@@ -1,6 +1,6 @@
from typing import List
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
@@ -34,12 +34,14 @@ def split_path(path: str, with_root=None) -> List[str]:
class FileTreeContextProvider(ContextProvider):
+ """Type '@tree' to reference the contents of your current workspace. The LLM will be able to see the nested directory structure of your project."""
+
title = "tree"
display_title = "File Tree"
description = "Add a formatted file tree of this directory to the context"
dynamic = True
- workspace_dir: str = None
+ workspace_dir: str = Field(None, description="The workspace directory to display")
async def _get_file_tree(self, directory: str) -> str:
contents = await self.sdk.ide.listDirectoryContents(directory, recursive=True)
diff --git a/continuedev/src/continuedev/plugins/context_providers/github.py b/continuedev/src/continuedev/plugins/context_providers/github.py
index 7a16d3c9..c031f310 100644
--- a/continuedev/src/continuedev/plugins/context_providers/github.py
+++ b/continuedev/src/continuedev/plugins/context_providers/github.py
@@ -1,6 +1,7 @@
from typing import List
from github import Auth, Github
+from pydantic import Field
from ...core.context import (
ContextItem,
@@ -12,13 +13,17 @@ from ...core.context import (
class GitHubIssuesContextProvider(ContextProvider):
"""
- The GitHubIssuesContextProvider is a ContextProvider
- that allows you to search GitHub issues in a repo.
+ The GitHubIssuesContextProvider is a ContextProvider that allows you to search GitHub issues in a repo. Type '@issue' to reference the title and contents of an issue.
"""
title = "issues"
- repo_name: str
- auth_token: str
+ repo_name: str = Field(
+ ..., description="The name of the GitHub repo from which to pull issues"
+ )
+ auth_token: str = Field(
+ ...,
+ description="The GitHub auth token to use to authenticate with the GitHub API",
+ )
display_title = "GitHub Issues"
description = "Reference GitHub issues"
diff --git a/continuedev/src/continuedev/plugins/context_providers/google.py b/continuedev/src/continuedev/plugins/context_providers/google.py
index 493806cc..852f4e9a 100644
--- a/continuedev/src/continuedev/plugins/context_providers/google.py
+++ b/continuedev/src/continuedev/plugins/context_providers/google.py
@@ -2,6 +2,7 @@ import json
from typing import List
import aiohttp
+from pydantic import Field
from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
@@ -9,15 +10,20 @@ from .util import remove_meilisearch_disallowed_chars
class GoogleContextProvider(ContextProvider):
+ """Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python."""
+
title = "google"
display_title = "Google"
description = "Search Google"
dynamic = True
requires_query = True
- serper_api_key: str
+ serper_api_key: str = Field(
+ ...,
+ description="Your SerpAPI key, used to programmatically make Google searches. You can get a key at https://serper.dev.",
+ )
- GOOGLE_CONTEXT_ITEM_ID = "google_search"
+ _GOOGLE_CONTEXT_ITEM_ID = "google_search"
@property
def BASE_CONTEXT_ITEM(self):
@@ -27,7 +33,7 @@ class GoogleContextProvider(ContextProvider):
name="Google Search",
description="Enter a query to search google",
id=ContextItemId(
- provider_title=self.title, item_id=self.GOOGLE_CONTEXT_ITEM_ID
+ provider_title=self.title, item_id=self._GOOGLE_CONTEXT_ITEM_ID
),
),
)
diff --git a/continuedev/src/continuedev/plugins/context_providers/search.py b/continuedev/src/continuedev/plugins/context_providers/search.py
index 4d9af580..4e2e33da 100644
--- a/continuedev/src/continuedev/plugins/context_providers/search.py
+++ b/continuedev/src/continuedev/plugins/context_providers/search.py
@@ -1,6 +1,7 @@
import os
from typing import List
+from pydantic import Field
from ripgrepy import Ripgrepy
from ...core.context import ContextProvider
@@ -10,15 +11,17 @@ from .util import remove_meilisearch_disallowed_chars
class SearchContextProvider(ContextProvider):
+ """Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search."""
+
title = "search"
display_title = "Search"
description = "Search the workspace for all matches of an exact string (e.g. '@search console.log')"
dynamic = True
requires_query = True
- SEARCH_CONTEXT_ITEM_ID = "search"
+ _SEARCH_CONTEXT_ITEM_ID = "search"
- workspace_dir: str = None
+ workspace_dir: str = Field(None, description="The workspace directory to search")
@property
def BASE_CONTEXT_ITEM(self):
@@ -28,7 +31,7 @@ class SearchContextProvider(ContextProvider):
name="Search",
description="Search the workspace for all matches of an exact string (e.g. '@search console.log')",
id=ContextItemId(
- provider_title=self.title, item_id=self.SEARCH_CONTEXT_ITEM_ID
+ provider_title=self.title, item_id=self._SEARCH_CONTEXT_ITEM_ID
),
),
)
diff --git a/continuedev/src/continuedev/plugins/context_providers/terminal.py b/continuedev/src/continuedev/plugins/context_providers/terminal.py
index f63ed676..c63239e4 100644
--- a/continuedev/src/continuedev/plugins/context_providers/terminal.py
+++ b/continuedev/src/continuedev/plugins/context_providers/terminal.py
@@ -1,17 +1,22 @@
from typing import Any, Coroutine, List
+from pydantic import Field
+
from ...core.context import ContextProvider
from ...core.main import ChatMessage, ContextItem, ContextItemDescription, ContextItemId
class TerminalContextProvider(ContextProvider):
+ """Type '@terminal' to reference the contents of your IDE's terminal."""
+
title = "terminal"
display_title = "Terminal"
description = "Reference the contents of the terminal"
dynamic = True
- workspace_dir: str = None
- get_last_n_commands: int = 3
+ get_last_n_commands: int = Field(
+ 3, description="The number of previous commands to reference"
+ )
def _terminal_context_item(self, content: str = ""):
return ContextItem(
@@ -30,7 +35,6 @@ class TerminalContextProvider(ContextProvider):
return msgs
async def provide_context_items(self, workspace_dir: str) -> List[ContextItem]:
- self.workspace_dir = workspace_dir
return [self._terminal_context_item()]
async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
diff --git a/continuedev/src/continuedev/plugins/context_providers/url.py b/continuedev/src/continuedev/plugins/context_providers/url.py
index c2c19cfb..2a293dc7 100644
--- a/continuedev/src/continuedev/plugins/context_providers/url.py
+++ b/continuedev/src/continuedev/plugins/context_providers/url.py
@@ -2,6 +2,7 @@ from typing import List
import requests
from bs4 import BeautifulSoup
+from pydantic import Field
from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
@@ -9,6 +10,8 @@ from .util import remove_meilisearch_disallowed_chars
class URLContextProvider(ContextProvider):
+ """Type '@url' to reference the contents of a URL. You can either reference preset URLs, or reference one dynamically by typing '@url https://example.com'. The text contents of the page will be fetched and used as context."""
+
title = "url"
display_title = "URL"
description = "Reference the contents of a webpage"
@@ -16,13 +19,16 @@ class URLContextProvider(ContextProvider):
requires_query = True
# Allows users to provide a list of preset urls
- preset_urls: List[str] = []
+ preset_urls: List[str] = Field(
+ [],
+ description="A list of preset URLs that you will be able to quickly reference by typing '@url'",
+ )
# Static items loaded from preset_urls
- static_url_context_items: List[ContextItem] = []
+ _static_url_context_items: List[ContextItem] = []
# There is only a single dynamic url context item, so it has a static id
- DYNAMIC_URL_CONTEXT_ITEM_ID = "url"
+ _DYNAMIC_URL_CONTEXT_ITEM_ID = "url"
# This is a template dynamic item that will generate context item on demand
# when get item is called
@@ -34,7 +40,7 @@ class URLContextProvider(ContextProvider):
name="Dynamic URL",
description="Reference the contents of a webpage (e.g. '@url https://www.w3schools.com/python/python_ref_functions.asp')",
id=ContextItemId(
- provider_title=self.title, item_id=self.DYNAMIC_URL_CONTEXT_ITEM_ID
+ provider_title=self.title, item_id=self._DYNAMIC_URL_CONTEXT_ITEM_ID
),
),
)
@@ -62,18 +68,18 @@ class URLContextProvider(ContextProvider):
return soup.get_text(), title
async def provide_context_items(self, workspace_dir: str) -> List[ContextItem]:
- self.static_url_context_items = [
+ self._static_url_context_items = [
self.static_url_context_item_from_url(url) for url in self.preset_urls
]
- return [self.DYNAMIC_CONTEXT_ITEM] + self.static_url_context_items
+ return [self.DYNAMIC_CONTEXT_ITEM] + self._static_url_context_items
async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
# Check if the item is a static item
matching_static_item = next(
(
item
- for item in self.static_url_context_items
+ for item in self._static_url_context_items
if item.description.id.item_id == id.item_id
),
None,