MCPcopy
hub / github.com/langchain-ai/langchain / _OpenAIResponseChain

Class _OpenAIResponseChain

libs/langchain/langchain/chains/flare/base.py:55–70  ·  view source on GitHub ↗

Chain that generates responses from user input and context.

Source from the content-addressed store, hash-verified

53
54
55class _OpenAIResponseChain(_ResponseChain):
56 """Chain that generates responses from user input and context."""
57
58 llm: BaseLanguageModel
59
60 def _extract_tokens_and_log_probs(
61 self, generations: List[Generation]
62 ) -> Tuple[Sequence[str], Sequence[float]]:
63 tokens = []
64 log_probs = []
65 for gen in generations:
66 if gen.generation_info is None:
67 raise ValueError
68 tokens.extend(gen.generation_info["logprobs"]["tokens"])
69 log_probs.extend(gen.generation_info["logprobs"]["token_logprobs"])
70 return tokens, log_probs
71
72
73class QuestionGeneratorChain(LLMChain):

Callers 1

from_llmMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected