Evaporate
BaseEvaporateProgram #
Bases: BasePydanticProgram, Generic[Model]
BaseEvaporate program.
You should provide the fields you want to extract. Then when you call the program you should pass in a list of training_data nodes and a list of infer_data nodes. The program will call the EvaporateExtractor to synthesize a python function from the training data and then apply the function to the infer_data.
Source code in llama_index/program/evaporate/base.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
from_defaults
classmethod
#
from_defaults(fields_to_extract: Optional[List[str]] = None, fields_context: Optional[Dict[str, Any]] = None, llm: Optional[LLM] = None, schema_id_prompt: Optional[SchemaIDPrompt] = None, fn_generate_prompt: Optional[FnGeneratePrompt] = None, field_extract_query_tmpl: str = DEFAULT_FIELD_EXTRACT_QUERY_TMPL, nodes_to_fit: Optional[List[BaseNode]] = None, verbose: bool = False) -> BaseEvaporateProgram
Evaporate program.
Source code in llama_index/program/evaporate/base.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_function_str #
get_function_str(field: str) -> str
Get function string.
Source code in llama_index/program/evaporate/base.py
89 90 91 | |
set_fields_to_extract #
set_fields_to_extract(fields: List[str]) -> None
Set fields to extract.
Source code in llama_index/program/evaporate/base.py
93 94 95 | |
fit_fields #
fit_fields(nodes: List[BaseNode], inplace: bool = True) -> Dict[str, str]
Fit on all fields.
Source code in llama_index/program/evaporate/base.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
fit
abstractmethod
#
fit(nodes: List[BaseNode], field: str, field_context: Optional[Any] = None, expected_output: Optional[Any] = None, inplace: bool = True) -> str
Given the input Nodes and fields, synthesize the python code.
Source code in llama_index/program/evaporate/base.py
114 115 116 117 118 119 120 121 122 123 | |
DFEvaporateProgram #
Bases: BaseEvaporateProgram[DataFrameRowsOnly]
Evaporate DF program.
Given a set of fields, extracts a dataframe from a set of nodes. Each node corresponds to a row in the dataframe - each value in the row corresponds to a field value.
Source code in llama_index/program/evaporate/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
fit #
fit(nodes: List[BaseNode], field: str, field_context: Optional[Any] = None, expected_output: Optional[Any] = None, inplace: bool = True) -> str
Given the input Nodes and fields, synthesize the python code.
Source code in llama_index/program/evaporate/base.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
options: members: - DFEvaporateProgram