diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index a3ac0590b..1046a74f8 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -360,9 +360,21 @@ const osModels = [ codeup, ]; +const gpt4turbo: ModelPackage = { + title: "GPT-4 Turbo", + description: + "A faster, cheaper version of GPT-4 with a longer context length", + params: { + model: "gpt-4-1106-preview", + context_length: 128_000, + title: "GPT-4 Turbo", + api_key: "", + }, +}; + const gpt4: ModelPackage = { title: "GPT-4", - description: "The latest model from OpenAI", + description: "The most powerful model from OpenAI", params: { model: "gpt-4", context_length: 8096, @@ -409,7 +421,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = { "Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.", icon: "openai.png", tags: [ModelProviderTag["Requires API Key"]], - packages: [gpt4, gpt35turbo], + packages: [gpt4, gpt35turbo, gpt4turbo], collectInputFor: [ { inputType: CollectInputType.text, diff --git a/server/continuedev/libs/index/build_index.py b/server/continuedev/libs/index/build_index.py index 8e1095169..30dfa3409 100644 --- a/server/continuedev/libs/index/build_index.py +++ b/server/continuedev/libs/index/build_index.py @@ -63,8 +63,9 @@ async def build_index( meilisearch_task = asyncio.create_task(meilisearch_task()) async for chunk, progress in stream_chunk_directory(ide, MAX_CHUNK_SIZE): - buffers[0].append(chunk) - buffers[1].append(chunk) + if chunk is not None: + buffers[0].append(chunk) + buffers[1].append(chunk) yield progress done = True diff --git a/server/continuedev/libs/index/chunkers/chunk_directory.py b/server/continuedev/libs/index/chunkers/chunk_directory.py index 595152857..07e7f3f1d 100644 --- a/server/continuedev/libs/index/chunkers/chunk_directory.py +++ b/server/continuedev/libs/index/chunkers/chunk_directory.py @@ -1,6 +1,6 @@ import asyncio import os -from typing import AsyncGenerator, Callable, List, Tuple +from typing import AsyncGenerator, Callable, List, Optional, Tuple from ....server.protocols.ide_protocol import AbstractIdeProtocolServer from ...util.filter_files import DEFAULT_IGNORE_PATTERNS, should_filter_path @@ -130,7 +130,7 @@ async def get_all_filepaths( async def stream_file_contents( ide: AbstractIdeProtocolServer, ignore_files: List[str] = [], group_size: int = 100 -) -> AsyncGenerator[Tuple[str, str, float], None]: +) -> AsyncGenerator[Tuple[str, Optional[str], float], None]: # Get list of filenames to index # TODO: Don't get all at once, walk the tree, or break up files, should_ignore = await get_all_filepaths(ide, ignore_files) @@ -140,7 +140,10 @@ async def stream_file_contents( total = len(files) for file in files: if should_ignore(file): + total = max(1, total - 1) + yield (file, None, i / total) continue + contents = await get_file_contents(file, ide) yield (file, contents, i / total) i += 1 @@ -148,7 +151,10 @@ async def stream_file_contents( async def stream_chunk_directory( ide: AbstractIdeProtocolServer, max_chunk_size: int -) -> AsyncGenerator[Tuple[Chunk, float], None]: +) -> AsyncGenerator[Tuple[Optional[Chunk], float], None]: async for file, contents, progress in stream_file_contents(ide): + if contents is None: + yield (None, progress) + continue for chunk in chunk_document(file, contents, max_chunk_size): yield (chunk, progress)