mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 08:27:03 +00:00
Update openai/create_llm_result function to consider kwargs (#13815)
Replace this entire comment with: - **Description:** updates `create_llm_result` function within `openai.py` to consider latest `params`, - **Issue:** #8928 - **Dependencies:** -, - **Tag maintainer:** - - **Twitter handle:** [burkomr](https://twitter.com/burkomr) <!-- If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17. --> --------- Co-authored-by: Burak Ömür <burakomur@retorio.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
f97ab84c6b
commit
0e462b72ef
@ -467,6 +467,7 @@ class BaseOpenAI(BaseLLM):
|
||||
return self.create_llm_result(
|
||||
choices,
|
||||
prompts,
|
||||
params,
|
||||
token_usage,
|
||||
system_fingerprint=system_fingerprint,
|
||||
)
|
||||
@ -524,6 +525,7 @@ class BaseOpenAI(BaseLLM):
|
||||
return self.create_llm_result(
|
||||
choices,
|
||||
prompts,
|
||||
params,
|
||||
token_usage,
|
||||
system_fingerprint=system_fingerprint,
|
||||
)
|
||||
@ -555,14 +557,16 @@ class BaseOpenAI(BaseLLM):
|
||||
self,
|
||||
choices: Any,
|
||||
prompts: List[str],
|
||||
params: Dict[str, Any],
|
||||
token_usage: Dict[str, int],
|
||||
*,
|
||||
system_fingerprint: Optional[str] = None,
|
||||
) -> LLMResult:
|
||||
"""Create the LLMResult from the choices and prompts."""
|
||||
generations = []
|
||||
n = params.get("n", self.n)
|
||||
for i, _ in enumerate(prompts):
|
||||
sub_choices = choices[i * self.n : (i + 1) * self.n]
|
||||
sub_choices = choices[i * n : (i + 1) * n]
|
||||
generations.append(
|
||||
[
|
||||
Generation(
|
||||
|
Loading…
Reference in New Issue
Block a user