refiner#

Attributes#

log

Classes#

JanusRefiner

SimpleRetry

FixParserExceptions

ReflectionRefiner

RequirementsReflectionRefiner

This requirements-specific refiner is intended to address a common issue with

HallucinationRefiner

Module Contents#

refiner.log#
class refiner.JanusRefiner#

Bases: janus.parsers.parser.JanusParser

parser: janus.parsers.parser.JanusParser#
parse_runnable(input)#
Parameters:

input (dict[str, Any]) –

Return type:

Any

parse_completion(completion, **kwargs)#
Parameters:

completion (str) –

Return type:

Any

abstract parse(text)#
Parameters:

text (str) –

Return type:

str

class refiner.SimpleRetry(llm, parser, max_retries)#

Bases: JanusRefiner

Parameters:
max_retries: int#
retry_chain: langchain_core.runnables.RunnableSerializable#
parse_completion(completion, prompt_value, **kwargs)#
Parameters:
  • completion (str) –

  • prompt_value (langchain_core.prompt_values.PromptValue) –

Return type:

Any

class refiner.FixParserExceptions(llm, parser, max_retries)#

Bases: JanusRefiner, langchain.output_parsers.RetryWithErrorOutputParser

Parameters:
parse_completion(completion, prompt_value, **kwargs)#
Parameters:
  • completion (str) –

  • prompt_value (langchain_core.prompt_values.PromptValue) –

Return type:

Any

class refiner.ReflectionRefiner(llm, parser, max_retries, prompt_template_name='refinement/reflection')#

Bases: JanusRefiner

Parameters:
max_retries: int#
reflection_chain: langchain_core.runnables.RunnableSerializable#
revision_chain: langchain_core.runnables.RunnableSerializable#
reflection_prompt_name: str#
parse_completion(completion, prompt_value, **kwargs)#
Parameters:
  • completion (str) –

  • prompt_value (langchain_core.prompt_values.PromptValue) –

Return type:

Any

class refiner.RequirementsReflectionRefiner(llm, parser, max_retries, prompt_template_name='refinement/reflection/incose')#

Bases: JanusRefiner

This requirements-specific refiner is intended to address a common issue with requirements reflection, where over the course of several reflection loops, requirements lists grow increasingly verbose, eventually becoming too wordy to be useful. To reduce this, this refiner interlaces an additional reflection -> revision loop which de-duplicates requirements.

Parameters:
max_retries: int#
reflection_chain: langchain_core.runnables.RunnableSerializable#
revision_chain: langchain_core.runnables.RunnableSerializable#
reflect_duplication_chain: langchain_core.runnables.RunnableSerializable#
revise_duplication_chain: langchain_core.runnables.RunnableSerializable#
reflection_prompt_name: str#
parse_completion(completion, prompt_value, **kwargs)#
Parameters:
  • completion (str) –

  • prompt_value (langchain_core.prompt_values.PromptValue) –

Return type:

Any

class refiner.HallucinationRefiner(**kwargs)#

Bases: ReflectionRefiner