Skip to content

Commit b589e8b

Browse files
committed
move TypePromptResourceDetails to separate file to fix circular dependency
1 parent 7723dc2 commit b589e8b

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

api/types/type_prompt_metadata.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
1414
from api.types.type_dataset import TypeDataset
1515
from api.utils.enums import (
1616
PromptDomain,
17-
PromptFormat,
1817
PromptTaskType,
1918
TargetLanguage,
2019
TargetModelType,
2120
)
2221

2322
prompt_task_type_enum: EnumType = strawberry.enum(PromptTaskType) # type: ignore
2423
prompt_domain_enum: EnumType = strawberry.enum(PromptDomain) # type: ignore
25-
prompt_format_enum: EnumType = strawberry.enum(PromptFormat) # type: ignore
2624
target_language_enum: EnumType = strawberry.enum(TargetLanguage) # type: ignore
2725
target_model_type_enum: EnumType = strawberry.enum(TargetModelType) # type: ignore
2826

@@ -57,14 +55,3 @@ class TypePromptMetadata:
5755
domain: Optional[prompt_domain_enum]
5856
target_model_types: Optional[List[target_model_type_enum]]
5957
evaluation_criteria: Optional[strawberry.scalars.JSON]
60-
61-
62-
@strawberry.type
63-
class TypePromptResourceDetails:
64-
"""Prompt-specific fields for a resource/file."""
65-
66-
prompt_format: Optional[prompt_format_enum]
67-
has_system_prompt: bool
68-
has_example_responses: bool
69-
avg_prompt_length: Optional[int]
70-
prompt_count: Optional[int]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""GraphQL type for prompt resource details."""
2+
3+
from typing import Optional
4+
5+
import strawberry
6+
from strawberry.enum import EnumType
7+
8+
from api.utils.enums import PromptFormat
9+
10+
# Create the enum for GraphQL schema
11+
prompt_format_enum: EnumType = strawberry.enum(PromptFormat) # type: ignore
12+
13+
14+
@strawberry.type
15+
class TypePromptResourceDetails:
16+
"""Prompt-specific fields for a resource/file."""
17+
18+
prompt_format: Optional[prompt_format_enum]
19+
has_system_prompt: bool
20+
has_example_responses: bool
21+
avg_prompt_length: Optional[int]
22+
prompt_count: Optional[int]

api/types/type_resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from api.types.base_type import BaseType
1919
from api.types.type_file_details import TypeFileDetails
2020
from api.types.type_preview_data import PreviewData
21-
from api.types.type_prompt_metadata import TypePromptResourceDetails
21+
from api.types.type_prompt_resource_details import TypePromptResourceDetails
2222
from api.types.type_resource_metadata import TypeResourceMetadata
2323
from api.utils.data_indexing import get_preview_data, get_row_count
2424
from api.utils.graphql_telemetry import trace_resolver

0 commit comments

Comments
 (0)