graphai.api.text.schemas module
- class graphai.api.text.schemas.WikifyFromRawTextRequest(*, raw_text: str)
Bases:
BaseModel
Object containing the raw text to be wikified.
- raw_text: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class graphai.api.text.schemas.WikifyFromKeywordsRequest(*, keywords: list[str])
Bases:
BaseModel
Object containing the keywords to be wikified.
- keywords: list[str]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class graphai.api.text.schemas.WikifyResponseElem(*, concept_id: int, concept_name: str, search_score: float, levenshtein_score: float, embedding_local_score: float, embedding_global_score: float, graph_score: float, ontology_local_score: float, ontology_global_score: float, embedding_keywords_score: float, graph_keywords_score: float, ontology_keywords_score: float, mixed_score: float)
Bases:
BaseModel
Object representing each of the wikify results. It consists of a set of keywords, a Wikipedia page and several scores which measure the degree of relevance of the result with respect to the text.
- concept_id: int
- concept_name: str
- search_score: float
- levenshtein_score: float
- embedding_local_score: float
- embedding_global_score: float
- graph_score: float
- ontology_local_score: float
- ontology_global_score: float
- embedding_keywords_score: float
- graph_keywords_score: float
- ontology_keywords_score: float
- mixed_score: float
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'examples': [{'concept_id': 1196, 'concept_name': 'Angle', 'embedding_global_score': 0.9447807640350212, 'embedding_keywords_score': 1, 'embedding_local_score': 0.936190393844887, 'graph_keywords_score': 0.9806112066572416, 'graph_score': 0.7920787642145825, 'levenshtein_score': 0.995049504950495, 'mixed_score': 0.974893873592604, 'ontology_global_score': 1, 'ontology_keywords_score': 1, 'ontology_local_score': 1, 'search_score': 0.9821428571428572}, {'concept_id': 12401488, 'concept_name': 'Triangle center', 'embedding_global_score': 0.6047569988500392, 'embedding_keywords_score': 0.18117340257708767, 'embedding_local_score': 0.5498335395955196, 'graph_keywords_score': 0.22692356368077668, 'graph_score': 0.30184919393927595, 'levenshtein_score': 0.4680631523928115, 'mixed_score': 0.3889476967863415, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.18009831669894236, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.3392857142857143}, {'concept_id': 13295107, 'concept_name': 'Transversal (geometry)', 'embedding_global_score': 0.7783132229139607, 'embedding_keywords_score': 0.8541509524253893, 'embedding_local_score': 0.7899500675092881, 'graph_keywords_score': 0.8158838242881319, 'graph_score': 0.079490218003065, 'levenshtein_score': 0.2110192540065071, 'mixed_score': 0.6477110513680882, 'ontology_global_score': 0.8333333333333333, 'ontology_keywords_score': 0.8540145985401459, 'ontology_local_score': 0.8333333333333333, 'search_score': 0.7178571428571429}, {'concept_id': 146689, 'concept_name': 'Earth radius', 'embedding_global_score': 0.6191743554865394, 'embedding_keywords_score': 0.3393292344705985, 'embedding_local_score': 0.6058537722364034, 'graph_keywords_score': 0.32094309692256273, 'graph_score': 0.04560562055085982, 'levenshtein_score': 0.5850789404910146, 'mixed_score': 0.2747973601576835, 'ontology_global_score': 0.0006414535135995178, 'ontology_keywords_score': 0.18025826114750698, 'ontology_local_score': 0.2222222222222222, 'search_score': 0.475}, {'concept_id': 152547, 'concept_name': 'Bisection', 'embedding_global_score': 0.5829791653941659, 'embedding_keywords_score': 0.6658021950254382, 'embedding_local_score': 0.5916531383849596, 'graph_keywords_score': 0.6072448552560294, 'graph_score': 0.3652836360342975, 'levenshtein_score': 0.2470772552749216, 'mixed_score': 0.49403585288280044, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6649784001191716, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.27142857142857146}, {'concept_id': 161243, 'concept_name': 'Nine-point circle', 'embedding_global_score': 0.5954070757052229, 'embedding_keywords_score': 0.6252501137210749, 'embedding_local_score': 0.6128662674658956, 'graph_keywords_score': 0.6809346631686672, 'graph_score': 0.23567484697484573, 'levenshtein_score': 0.3974121105221985, 'mixed_score': 0.5454425715474266, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6234172501117234, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.5428571428571429}, {'concept_id': 165487, 'concept_name': 'World line', 'embedding_global_score': 0.5875702591903744, 'embedding_keywords_score': 0.32915926499040604, 'embedding_local_score': 0.5557247926738698, 'graph_keywords_score': 0.35937866385263295, 'graph_score': 0.018301492693509606, 'levenshtein_score': 0.20854298868986648, 'mixed_score': 0.35381073854308764, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.3324892000595859, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.27142857142857146}, {'concept_id': 1780815, 'concept_name': 'Radius', 'embedding_global_score': 0.6123892146782264, 'embedding_keywords_score': 0.3393292344705985, 'embedding_local_score': 0.6058537722364034, 'graph_keywords_score': 0.32094309692256273, 'graph_score': 0.40341637127911656, 'levenshtein_score': 0.7313486756137682, 'mixed_score': 0.43983570252851467, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.18025826114750698, 'ontology_local_score': 0.2222222222222222, 'search_score': 0.6785714285714286}, {'concept_id': 1896705, 'concept_name': 'Osculating circle', 'embedding_global_score': 0.6001356168702854, 'embedding_keywords_score': 0.6252501137210749, 'embedding_local_score': 0.6095596040570643, 'graph_keywords_score': 0.6809346631686672, 'graph_score': 0.15095693713821154, 'levenshtein_score': 0.3974121105221985, 'mixed_score': 0.44197078056376315, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6234172501117234, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.06785714285714284}, {'concept_id': 1898401, 'concept_name': 'Arc length', 'embedding_global_score': 0.6206023872446591, 'embedding_keywords_score': 0.45726985451624325, 'embedding_local_score': 0.6214735523605726, 'graph_keywords_score': 0.5967180832515523, 'graph_score': 0.37885045617052326, 'levenshtein_score': 0.09530697673156802, 'mixed_score': 0.429472346018896, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.41496111506273836, 'ontology_local_score': 0.6075750180441352, 'search_score': 0.475}, {'concept_id': 1975821, 'concept_name': 'Skew lines', 'embedding_global_score': 0.6071866898797716, 'embedding_keywords_score': 0.453132323677798, 'embedding_local_score': 0.5926923831317541, 'graph_keywords_score': 0.6342079203068262, 'graph_score': 0.1467272460558672, 'levenshtein_score': 0.4842714203388464, 'mixed_score': 0.4997033279190881, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.4571726500819306, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.5428571428571429}, {'concept_id': 201359, 'concept_name': 'Squaring the circle', 'embedding_global_score': 0.6094673983855882, 'embedding_keywords_score': 0.6252501137210749, 'embedding_local_score': 0.6228894106876862, 'graph_keywords_score': 0.6809346631686672, 'graph_score': 0.1853365490872417, 'levenshtein_score': 0.33646712232710085, 'mixed_score': 0.4634098506722587, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6234172501117234, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.2035714285714286}, {'concept_id': 22634860, 'concept_name': 'Line segment', 'embedding_global_score': 0.6015345514255728, 'embedding_keywords_score': 0.44397434138761116, 'embedding_local_score': 0.6289329297461709, 'graph_keywords_score': 0.6463107906576082, 'graph_score': 0.5940970321127149, 'levenshtein_score': 0.1325957938789834, 'mixed_score': 0.47811753398436485, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.4571726500819306, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.475}, {'concept_id': 250265, 'concept_name': 'Rhumb line', 'embedding_global_score': 0.7314235936190492, 'embedding_keywords_score': 0.5403307788136165, 'embedding_local_score': 0.7146040614704057, 'graph_keywords_score': 0.7244902789723203, 'graph_score': 0.10852920758292811, 'levenshtein_score': 0.36085995785542146, 'mixed_score': 0.49088968517023296, 'ontology_global_score': 0.5297660279561411, 'ontology_keywords_score': 0.48877312914546234, 'ontology_local_score': 0.4848520041529702, 'search_score': 0.7678571428571428}, {'concept_id': 31482, 'concept_name': 'Tangent', 'embedding_global_score': 0.59976908308104, 'embedding_keywords_score': 0.32915926499040604, 'embedding_local_score': 0.5557247926738698, 'graph_keywords_score': 0.35937866385263295, 'graph_score': 0.4963883113854736, 'levenshtein_score': 0.1724878951919264, 'mixed_score': 0.35549687067330726, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.3324892000595859, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.06785714285714284}, {'concept_id': 3307757, 'concept_name': 'Simson line', 'embedding_global_score': 0.578947689005502, 'embedding_keywords_score': 0.44397434138761116, 'embedding_local_score': 0.6270069103429565, 'graph_keywords_score': 0.6463107906576082, 'graph_score': 0.013581124397822893, 'levenshtein_score': 0.4842714203388464, 'mixed_score': 0.43210300146756936, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.4571726500819306, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.27142857142857146}, {'concept_id': 462730, 'concept_name': 'Inscribed angle', 'embedding_global_score': 0.768343013064605, 'embedding_keywords_score': 0.8541509524253893, 'embedding_local_score': 0.7717801666974846, 'graph_keywords_score': 0.8158838242881319, 'graph_score': 0.12482171404042144, 'levenshtein_score': 0.6445516077439113, 'mixed_score': 0.6622740540324344, 'ontology_global_score': 0.8333333333333333, 'ontology_keywords_score': 0.8540145985401459, 'ontology_local_score': 0.8333333333333333, 'search_score': 0.44285714285714284}, {'concept_id': 48082, 'concept_name': 'Great circle', 'embedding_global_score': 0.6151678032679938, 'embedding_keywords_score': 0.6252501137210749, 'embedding_local_score': 0.6194506424602977, 'graph_keywords_score': 0.6809346631686672, 'graph_score': 0.5237975686048405, 'levenshtein_score': 0.5850789404910146, 'mixed_score': 0.5752620110628913, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6234172501117234, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.40714285714285714}, {'concept_id': 524003, 'concept_name': 'Internal and external angles', 'embedding_global_score': 0.9544700262181692, 'embedding_keywords_score': 1, 'embedding_local_score': 0.9547191776223249, 'graph_keywords_score': 0.9806112066572416, 'graph_score': 0.06348267860292894, 'levenshtein_score': 0.6012700464524801, 'mixed_score': 0.8358244891138791, 'ontology_global_score': 1, 'ontology_keywords_score': 1, 'ontology_local_score': 1, 'search_score': 0.9464285714285714}, {'concept_id': 5407025, 'concept_name': 'Sum of angles of a triangle', 'embedding_global_score': 0.7428783723631838, 'embedding_keywords_score': 0.8541509524253893, 'embedding_local_score': 0.7502904601610197, 'graph_keywords_score': 0.8158838242881319, 'graph_score': 0.006235350315249621, 'levenshtein_score': 0.39303319759855243, 'mixed_score': 0.6026876561381135, 'ontology_global_score': 0.8333333333333333, 'ontology_keywords_score': 0.8540145985401459, 'ontology_local_score': 0.8333333333333333, 'search_score': 0.3928571428571429}, {'concept_id': 6220, 'concept_name': 'Circle', 'embedding_global_score': 0.6044584589208712, 'embedding_keywords_score': 0.6252501137210749, 'embedding_local_score': 0.6247087590356082, 'graph_keywords_score': 0.6809346631686672, 'graph_score': 0.5495989056289238, 'levenshtein_score': 0.7313486756137682, 'mixed_score': 0.6404968907479984, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.6234172501117234, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.6107142857142858}, {'concept_id': 664497, 'concept_name': 'Parallel (geometry)', 'embedding_global_score': 0.6220133585096995, 'embedding_keywords_score': 0.453132323677798, 'embedding_local_score': 0.6017217718876411, 'graph_keywords_score': 0.6342079203068262, 'graph_score': 0.40095604092651027, 'levenshtein_score': 0.06793369410635872, 'mixed_score': 0.3948184056141364, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.4571726500819306, 'ontology_local_score': 0.6666666666666666, 'search_score': 0.2035714285714286}, {'concept_id': 76956, 'concept_name': 'Right angle', 'embedding_global_score': 0.7548885234150651, 'embedding_keywords_score': 0.8246343320198054, 'embedding_local_score': 0.7571720795352108, 'graph_keywords_score': 0.8192570426095808, 'graph_score': 0.3076508249923096, 'levenshtein_score': 0.5768412624599064, 'mixed_score': 0.7030698606760027, 'ontology_global_score': 0.8333333333333333, 'ontology_keywords_score': 0.8248175182481752, 'ontology_local_score': 0.8333333333333333, 'search_score': 0.65}, {'concept_id': 89246, 'concept_name': 'Curve', 'embedding_global_score': 0.6058837846959582, 'embedding_keywords_score': 0.45726985451624325, 'embedding_local_score': 0.6061010985898527, 'graph_keywords_score': 0.5967180832515523, 'graph_score': 0.6010512105924976, 'levenshtein_score': 0.009984282260938813, 'mixed_score': 0.4660368744333562, 'ontology_global_score': 0.6666666666666666, 'ontology_keywords_score': 0.41496111506273836, 'ontology_local_score': 0.6075750180441352, 'search_score': 0.6107142857142858}, {'concept_id': 91111, 'concept_name': 'Angle trisection', 'embedding_global_score': 0.7222511927302219, 'embedding_keywords_score': 0.8246343320198054, 'embedding_local_score': 0.7114737175075206, 'graph_keywords_score': 0.8192570426095808, 'graph_score': 0.42053296186769257, 'levenshtein_score': 0.5472899496445176, 'mixed_score': 0.7163539488698042, 'ontology_global_score': 0.8333333333333333, 'ontology_keywords_score': 0.8248175182481752, 'ontology_local_score': 0.8333333333333333, 'search_score': 0.6821428571428572}, {'concept_id': 946975, 'concept_name': 'Line (geometry)', 'embedding_global_score': 0.8476721575861583, 'embedding_keywords_score': 0.653131668312657, 'embedding_local_score': 0.9162572314594017, 'graph_keywords_score': 0.9426016455778317, 'graph_score': 1, 'levenshtein_score': 0.2862599599983249, 'mixed_score': 0.7850418748754415, 'ontology_global_score': 1, 'ontology_keywords_score': 0.6514226203690341, 'ontology_local_score': 0.9778406317665507, 'search_score': 1}]}}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class graphai.api.text.schemas.KeywordsRequest(*, raw_text: str)
Bases:
BaseModel
Object containing the raw text to extract keywords.
- raw_text: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class graphai.api.text.schemas.GenerateTextExerciseRequest(*, text: str, description: str = '', bloom_level: Literal[None, 1, 2, 3, 4, 5, 6] = None, include_solution: bool = True, output_format: Literal['plain-text', 'markdown', 'latex'] = 'markdown', llm_model: Literal['gpt-4o-mini', 'gpt-4o'] = 'gpt-4o-mini', openai_api_key: str)
Bases:
BaseModel
Object containing the input to generate with an LLM an exercise from a text.
- text: str
- description: str
- bloom_level: Literal[None, 1, 2, 3, 4, 5, 6]
- include_solution: bool
- output_format: Literal['plain-text', 'markdown', 'latex']
- llm_model: Literal['gpt-4o-mini', 'gpt-4o']
- openai_api_key: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class graphai.api.text.schemas.GenerateLectureExerciseRequest(*, lecture_id: str, description: str = '', bloom_level: Literal[None, 1, 2, 3, 4, 5, 6] = None, include_solution: bool = True, output_format: Literal['plain-text', 'markdown', 'latex'] = 'markdown', llm_model: Literal['gpt-4o-mini', 'gpt-4o'] = 'gpt-4o-mini', openai_api_key: str)
Bases:
BaseModel
Object containing the input to generate with an LLM an exercise from the content of a lecture.
- lecture_id: str
- description: str
- bloom_level: Literal[None, 1, 2, 3, 4, 5, 6]
- include_solution: bool
- output_format: Literal['plain-text', 'markdown', 'latex']
- llm_model: Literal['gpt-4o-mini', 'gpt-4o']
- openai_api_key: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].