update default config comment, verify_ssl

This commit is contained in:
Nate Sesti 2023-08-03 10:28:26 -07:00
parent ac3f9acf83
commit da9caea0a9
4 changed files with 17 additions and 9 deletions

View file

@ -2,8 +2,7 @@ default_config = """\
\"\"\"
This is the Continue configuration file.
If you aren't getting strong typing on these imports,
be sure to select the Python interpreter in ~/.continue/server/env.
See https://continue.dev/docs/customization to learn more.
\"\"\"
import subprocess

View file

@ -8,12 +8,12 @@ from ...core.main import ChatMessage
from ..llm import LLM
from ..util.count_tokens import compile_chat_messages, DEFAULT_ARGS, count_tokens
SERVER_URL = "http://localhost:8000"
class GGML(LLM):
# this is model-specific
max_context_length: int = 2048
server_url: str = "http://localhost:8000"
verify_ssl: bool = True
_client_session: aiohttp.ClientSession = None
@ -21,7 +21,8 @@ class GGML(LLM):
arbitrary_types_allowed = True
async def start(self, **kwargs):
self._client_session = aiohttp.ClientSession()
self._client_session = aiohttp.ClientSession(
connector=aiohttp.TCPConnector(verify_ssl=self.verify_ssl))
async def stop(self):
await self._client_session.close()
@ -50,7 +51,7 @@ class GGML(LLM):
messages = compile_chat_messages(
self.name, with_history, self.context_length, args["max_tokens"], prompt, functions=args.get("functions", None), system_message=self.system_message)
async with self._client_session.post(f"{SERVER_URL}/v1/completions", json={
async with self._client_session.post(f"{self.server_url}/v1/completions", json={
"messages": messages,
**args
}) as resp:
@ -67,7 +68,7 @@ class GGML(LLM):
self.name, messages, self.context_length, args["max_tokens"], None, functions=args.get("functions", None), system_message=self.system_message)
args["stream"] = True
async with self._client_session.post(f"{SERVER_URL}/v1/chat/completions", json={
async with self._client_session.post(f"{self.server_url}/v1/chat/completions", json={
"messages": messages,
**args
}) as resp:
@ -88,7 +89,7 @@ class GGML(LLM):
async def complete(self, prompt: str, with_history: List[ChatMessage] = None, **kwargs) -> Coroutine[Any, Any, str]:
args = {**self.default_args, **kwargs}
async with self._client_session.post(f"{SERVER_URL}/v1/completions", json={
async with self._client_session.post(f"{self.server_url}/v1/completions", json={
"messages": compile_chat_messages(args["model"], with_history, self.context_length, args["max_tokens"], prompt, functions=None, system_message=self.system_message),
**args
}) as resp:

View file

@ -29,6 +29,8 @@ MAX_TOKENS_FOR_MODEL = {
class OpenAI(LLM):
model: str
openai_server_info: Optional[OpenAIServerInfo] = None
verify_ssl: bool = True
ca_bundle_path: Optional[str] = None
requires_api_key = "OPENAI_API_KEY"
requires_write_log = True
@ -49,6 +51,12 @@ class OpenAI(LLM):
if self.openai_server_info.api_version is not None:
openai.api_version = self.openai_server_info.api_version
if self.verify_ssl == False:
openai.verify_ssl_certs = False
if self.ca_bundle_path is not None:
openai.ca_bundle_path = self.ca_bundle_path
async def stop(self):
pass

View file

@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "The open-source coding autopilot",
"version": "0.0.249",
"version": "0.0.250",
"publisher": "Continue",
"engines": {
"vscode": "^1.67.0"