Skip to content

Commit

Permalink
Update model description (#103)
Browse files Browse the repository at this point in the history
Update model description
  • Loading branch information
eyurtsev authored Mar 22, 2024
1 parent 4b14415 commit dd3076a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
10 changes: 9 additions & 1 deletion backend/server/api/configurables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ class ConfigurationResponse(TypedDict):
max_file_size_mb: int
max_concurrency: int
max_chunks: int
models: List[dict]


@router.get("")
def get() -> ConfigurationResponse:
"""Endpoint to show server configuration."""
return {
"available_models": sorted(SUPPORTED_MODELS),
"available_models": sorted(SUPPORTED_MODELS), # Deprecate
"models": [
{
"name": model,
"description": data["description"],
}
for model, data in SUPPORTED_MODELS.items()
],
"accepted_mimetypes": SUPPORTED_MIMETYPES,
"max_file_size_mb": MAX_FILE_SIZE_MB,
"max_concurrency": MAX_CONCURRENCY,
Expand Down
1 change: 1 addition & 0 deletions backend/tests/unit_tests/api/test_api_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ async def test_configuration_api() -> None:
"max_chunks",
"max_concurrency",
"max_file_size_mb",
"models",
]
models = result["available_models"]
assert all(isinstance(model_name, str) for model_name in models)
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ export const Playground = (props: PlaygroundProps) => {
<FormLabel as="legend">Extraction Model</FormLabel>
<RadioGroup
name="modelId"
defaultValue={requestServerConfig.data?.available_models[0]}
defaultValue={requestServerConfig.data?.models[0].name}
>
<HStack spacing="24px">
{requestServerConfig.data?.available_models.map((model) => (
<Radio value={model} key={model}>
{model}
{requestServerConfig.data?.models.map((model) => (
<Radio value={model.name} key={model.name}>
{model.description}
</Radio>
))}
</HStack>
Expand Down
7 changes: 6 additions & 1 deletion frontend/app/utils/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ const createExtractor: MutationFunction<any, any> = async (extractor) => {
return response.data;
};

export type Model = {
name: string;
description: string;
};

export type ServerConfiguration = {
available_models: string[];
max_file_size_mb: number;
accepted_mimetypes: string[];
models: Model[];
};

const getConfiguration = async (): Promise<ServerConfiguration> => {
Expand Down

0 comments on commit dd3076a

Please sign in to comment.