autorag.data.qa.generation_gt package

Submodules

autorag.data.qa.generation_gt.base module

autorag.data.qa.generation_gt.base.add_gen_gt(row: Dict, new_gen_gt: str) Dict[source]

autorag.data.qa.generation_gt.llama_index_gen_gt module

async autorag.data.qa.generation_gt.llama_index_gen_gt.make_basic_gen_gt(row: Dict, llm: BaseLLM, lang: str = 'en') Dict[source]
async autorag.data.qa.generation_gt.llama_index_gen_gt.make_concise_gen_gt(row: Dict, llm: BaseLLM, lang: str = 'en') Dict[source]
async autorag.data.qa.generation_gt.llama_index_gen_gt.make_custom_gen_gt(row: Dict, llm: BaseLLM, system_prompt: str) Dict[source]
async autorag.data.qa.generation_gt.llama_index_gen_gt.make_gen_gt_llama_index(row: Dict, llm: BaseLLM, system_prompt: str) Dict[source]

autorag.data.qa.generation_gt.openai_gen_gt module

class autorag.data.qa.generation_gt.openai_gen_gt.Response(*, answer: str)[source]

Bases: BaseModel

answer: str
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'answer': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

async autorag.data.qa.generation_gt.openai_gen_gt.make_basic_gen_gt(row: Dict, client: AsyncOpenAI, model_name: str = 'gpt-4o-2024-08-06', lang: str = 'en')[source]

Generate basic generation_gt using OpenAI Structured Output for preventing errors. It generates a “basic” answer, and its prompt is simple.

Parameters:
  • row – The input row of the qa dataframe.

  • client – The OpenAI async client.

  • model_name – The model name that supports structured output. It has to be “gpt-4o-2024-08-06” or “gpt-4o-mini-2024-07-18”.

  • lang – The language code of the prompt. Default is “en”.

Returns:

The output row of the qa dataframe with added “generation_gt” in it.

async autorag.data.qa.generation_gt.openai_gen_gt.make_concise_gen_gt(row: Dict, client: AsyncOpenAI, model_name: str = 'gpt-4o-2024-08-06', lang: str = 'en')[source]

Generate concise generation_gt using OpenAI Structured Output for preventing errors. It generates a concise answer, so it is generally a word or just a phrase.

Parameters:
  • row – The input row of the qa dataframe.

  • client – The OpenAI async client.

  • model_name – The model name that supports structured output. It has to be “gpt-4o-2024-08-06” or “gpt-4o-mini-2024-07-18”.

  • lang – The language code of the prompt. Default is “en”.

Returns:

The output row of the qa dataframe with added “generation_gt” in it.

async autorag.data.qa.generation_gt.openai_gen_gt.make_gen_gt_openai(row: Dict, client: AsyncOpenAI, system_prompt: str, model_name: str = 'gpt-4o-2024-08-06')[source]

autorag.data.qa.generation_gt.prompt module

Module contents