Bases: BaseLlamaindexLLMOutputExtractor
OpenAI Llamaindex LLM Output Extractor.
Source code in src/augmentation/components/llms/openai/output_extractor.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | class OpenAILlamaindexLLMOutputExtractor(BaseLlamaindexLLMOutputExtractor):
"""OpenAI Llamaindex LLM Output Extractor."""
def get_text(self, trace: TraceWithDetails) -> str:
"""
Extracts the text from the trace output.
Args:
trace (TraceWithDetails): The trace with details.
Returns:
str: The extracted text.
"""
return trace.output["blocks"][0]["text"]
def get_generated_by_model(self, trace: TraceWithDetails) -> str:
"""
Extracts the model name from the trace output.
Args:
trace (TraceWithDetails): The trace with details.
Returns:
str: The name of the model.
"""
return self.configuration.name
|
get_generated_by_model(trace)
Extracts the model name from the trace output.
Parameters: |
-
trace
(TraceWithDetails )
–
|
Source code in src/augmentation/components/llms/openai/output_extractor.py
31
32
33
34
35
36
37
38
39
40
41 | def get_generated_by_model(self, trace: TraceWithDetails) -> str:
"""
Extracts the model name from the trace output.
Args:
trace (TraceWithDetails): The trace with details.
Returns:
str: The name of the model.
"""
return self.configuration.name
|
get_text(trace)
Extracts the text from the trace output.
Parameters: |
-
trace
(TraceWithDetails )
–
|
Source code in src/augmentation/components/llms/openai/output_extractor.py
19
20
21
22
23
24
25
26
27
28
29 | def get_text(self, trace: TraceWithDetails) -> str:
"""
Extracts the text from the trace output.
Args:
trace (TraceWithDetails): The trace with details.
Returns:
str: The extracted text.
"""
return trace.output["blocks"][0]["text"]
|