graphai.api.ontology.schemas module

class graphai.api.ontology.schemas.TreeResponseElem(*, child_id: str, parent_id: str)

Bases: BaseModel

Object representing the output of the /ontology/tree endpoint.

child_id: str
parent_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.TreeResponse(*, child_to_parent: List[TreeResponseElem] | None = None)

Bases: BaseModel

child_to_parent: List[TreeResponseElem] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.CategoryInfoResponse(*, category_id: str, depth: int, id: str, name: str)

Bases: BaseModel

category_id: str
depth: int
id: str
name: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.ConceptDetails(*, id: str | None, name: str | None)

Bases: BaseModel

id: str | None
name: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.CategoryDetailsResponse(*, info: CategoryInfoResponse | None, parent_category: str | None, child_categories: List[str] | None, clusters: List[str] | None, concepts: List[ConceptDetails] | None)

Bases: BaseModel

info: CategoryInfoResponse | None
parent_category: str | None
child_categories: List[str] | None
clusters: List[str] | None
concepts: List[ConceptDetails] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.ClusterDetailsResponse(*, parent: str | None, concepts: List[ConceptDetails] | None)

Bases: BaseModel

parent: str | None
concepts: List[ConceptDetails] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.ConceptDetailsSingleResponse(*, id: str | None, name: str | None, parent_category: str | None, parent_cluster: str | None, branch: List[str] | None)

Bases: ConceptDetails

parent_category: str | None
parent_cluster: str | None
branch: List[str] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.OpenalexCategoryNearestTopicsResponseElem(*, category_id: str, category_name: str, topic_id: str, topic_name: str, embedding_score: float, wikipedia_score: float, score: float)

Bases: BaseModel

category_id: str
category_name: str
topic_id: str
topic_name: str
embedding_score: float
wikipedia_score: float
score: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

graphai.api.ontology.schemas.OpenalexTopicNearestCategoriesResponseElem

alias of OpenalexCategoryNearestTopicsResponseElem

class graphai.api.ontology.schemas.RecomputeClustersRequest(*, n_clusters: int = 2200, min_n: int = 1)

Bases: BaseModel

n_clusters: int
min_n: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.OneConceptResponseElement(*, name: str, id: int)

Bases: BaseModel

name: str
id: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.RecomputeClustersTaskResponse(*, results: Dict[int, List[OneConceptResponseElement]] | None = None, category_assignments: Dict[int, str] | None = None, impurity_count: int, impurity_proportion: float, successful: bool)

Bases: BaseModel

results: Dict[int, List[OneConceptResponseElement]] | None
category_assignments: Dict[int, str] | None
impurity_count: int
impurity_proportion: float
successful: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.RecomputeClustersResponse(*, task_id: str, task_name: str | None = None, task_status: str, task_result: RecomputeClustersTaskResponse | None)

Bases: TaskStatusResponse

task_result: RecomputeClustersTaskResponse | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.BreakUpClusterRequest(*, cluster_id: str, n_clusters: int | List[int] = 2)

Bases: BaseModel

cluster_id: str
n_clusters: int | List[int]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.BreakUpClustersClusterNumberResponse(*, clusters: Dict[int, List[OneConceptResponseElement]] | None = None, n_clusters: int)

Bases: BaseModel

clusters: Dict[int, List[OneConceptResponseElement]] | None
n_clusters: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.BreakUpClustersResponse(*, results: List[BreakUpClustersClusterNumberResponse] | None = None)

Bases: BaseModel

results: List[BreakUpClustersClusterNumberResponse] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphDistanceRequest(*, src: str, src_type: Literal['concept', 'cluster', 'category'] = 'concept', tgt: str, tgt_type: Literal['concept', 'cluster', 'category'] = 'category', avg: Literal['none', 'linear', 'log'] = 'linear', coeffs: None | Tuple[float, float] = (1.0, 1.0))

Bases: BaseModel

src: str
src_type: Literal['concept', 'cluster', 'category']
tgt: str
tgt_type: Literal['concept', 'cluster', 'category']
avg: Literal['none', 'linear', 'log']
coeffs: None | Tuple[float, float]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphDistanceResponse(*, sim: None | float = None)

Bases: BaseModel

sim: None | float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphNearestCategoryRequest(*, avg: Literal['none', 'linear', 'log', 'adaptive'] = 'log', coeffs: None | Tuple[float, float] = (1.0, 10.0), top_n: int = 1, top_down_search: bool = False, use_embeddings: bool = False)

Bases: BaseModel

avg: Literal['none', 'linear', 'log', 'adaptive']
coeffs: None | Tuple[float, float]
top_n: int
use_embeddings: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphConceptNearestCategoryRequest(*, avg: Literal['none', 'linear', 'log', 'adaptive'] = 'log', coeffs: None | Tuple[float, float] = (1.0, 10.0), top_n: int = 1, top_down_search: bool = False, use_embeddings: bool = False, src: str, return_clusters: int | None = 3)

Bases: GraphNearestCategoryRequest

src: str
return_clusters: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphClusterNearestCategoryRequest(*, avg: Literal['none', 'linear', 'log', 'adaptive'] = 'log', coeffs: None | Tuple[float, float] = (1.0, 10.0), top_n: int = 1, top_down_search: bool = False, use_embeddings: bool = False, src: List[str] | str)

Bases: GraphNearestCategoryRequest

src: List[str] | str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.NearestClusterElement(*, cluster_id: str, score: float, rank: int)

Bases: BaseModel

cluster_id: str
score: float
rank: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.NearestCategoryElement(*, category_id: str, score: float, rank: int)

Bases: BaseModel

category_id: str
score: float
rank: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.NearestCategoryElementWithClusters(*, category_id: str, score: float, rank: int, clusters: List[NearestClusterElement] | None = None)

Bases: NearestCategoryElement

clusters: List[NearestClusterElement] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.EmbeddingEnabledNearestEntityResponse(*, embeddings_used: bool)

Bases: BaseModel

embeddings_used: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphConceptNearestCategoryResponse(*, embeddings_used: bool, scores: None | List[NearestCategoryElementWithClusters] = None, parent_category: None | str = None, valid: bool, existing_label: str | None = None)

Bases: EmbeddingEnabledNearestEntityResponse

scores: None | List[NearestCategoryElementWithClusters]
parent_category: None | str
valid: bool
existing_label: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphClusterNearestCategoryResponse(*, embeddings_used: bool, scores: None | List[NearestCategoryElement] = None, parent_category: None | str = None, existing_label: str | None = None)

Bases: EmbeddingEnabledNearestEntityResponse

scores: None | List[NearestCategoryElement]
parent_category: None | str
existing_label: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphNearestConceptRequest(*, src: str, top_n: int = 1, use_embeddings: bool = False)

Bases: BaseModel

src: str
top_n: int
use_embeddings: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class graphai.api.ontology.schemas.GraphNearestConceptResponse(*, embeddings_used: bool, closest: None | List[str] = None, scores: None | List[float] = None)

Bases: EmbeddingEnabledNearestEntityResponse

closest: None | List[str]
scores: None | List[float]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].