⚡️ chunking progress update, gpt-4-turbo
This commit is contained in:
parent
e3d7745acb
commit
b7f41d724a
3 changed files with 26 additions and 7 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue