mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 17:13:22 +00:00
community[patch]: fix agenerate return value (#14815)
Fixed: - `_agenerate` return value in the YandexGPT Chat Model - duplicate line in the documentation Co-authored-by: Dmitry Tyumentsev <dmitry.tyumentsev@raftds.com>
This commit is contained in:
parent
f1d3f29bc4
commit
78ae276df7
@ -46,8 +46,6 @@
|
|||||||
"- [API key](https://cloud.yandex.com/en/docs/iam/operations/api-key/create)\n",
|
"- [API key](https://cloud.yandex.com/en/docs/iam/operations/api-key/create)\n",
|
||||||
" You can specify the key in a constructor parameter `api_key` or in an environment variable `YC_API_KEY`.\n",
|
" You can specify the key in a constructor parameter `api_key` or in an environment variable `YC_API_KEY`.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In the `model_uri` parameter, specify the model used, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
|
||||||
"\n",
|
|
||||||
"To specify the model you can use `model_uri` parameter, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
"To specify the model you can use `model_uri` parameter, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"By default, the latest version of `yandexgpt-lite` is used from the folder specified in the parameter `folder_id` or `YC_FOLDER_ID` environment variable."
|
"By default, the latest version of `yandexgpt-lite` is used from the folder specified in the parameter `folder_id` or `YC_FOLDER_ID` environment variable."
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
"- [API key](https://cloud.yandex.com/en/docs/iam/operations/api-key/create)\n",
|
"- [API key](https://cloud.yandex.com/en/docs/iam/operations/api-key/create)\n",
|
||||||
" You can specify the key in a constructor parameter `api_key` or in an environment variable `YC_API_KEY`.\n",
|
" You can specify the key in a constructor parameter `api_key` or in an environment variable `YC_API_KEY`.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In the `model_uri` parameter, specify the model used, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
|
||||||
"\n",
|
|
||||||
"To specify the model you can use `model_uri` parameter, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
"To specify the model you can use `model_uri` parameter, see [the documentation](https://cloud.yandex.com/en/docs/yandexgpt/concepts/models#yandexgpt-generation) for more details.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"By default, the latest version of `yandexgpt-lite` is used from the folder specified in the parameter `folder_id` or `YC_FOLDER_ID` environment variable."
|
"By default, the latest version of `yandexgpt-lite` is used from the folder specified in the parameter `folder_id` or `YC_FOLDER_ID` environment variable."
|
||||||
|
@ -192,9 +192,9 @@ class ChatYandexGPT(_BaseYandexGPT, BaseChatModel):
|
|||||||
operation_request, metadata=self._grpc_metadata
|
operation_request, metadata=self._grpc_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
instruct_response = CompletionResponse()
|
completion_response = CompletionResponse()
|
||||||
operation.response.Unpack(instruct_response)
|
operation.response.Unpack(completion_response)
|
||||||
text = instruct_response.alternatives[0].message.text
|
text = completion_response.alternatives[0].message.text
|
||||||
if stop is not None:
|
text = text if stop is None else enforce_stop_tokens(text, stop)
|
||||||
text = enforce_stop_tokens(text, stop)
|
message = AIMessage(content=text)
|
||||||
return text
|
return ChatResult(generations=[ChatGeneration(message=message)])
|
||||||
|
@ -232,9 +232,9 @@ class YandexGPT(_BaseYandexGPT, LLM):
|
|||||||
operation_request, metadata=self._grpc_metadata
|
operation_request, metadata=self._grpc_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
instruct_response = CompletionResponse()
|
completion_response = CompletionResponse()
|
||||||
operation.response.Unpack(instruct_response)
|
operation.response.Unpack(completion_response)
|
||||||
text = instruct_response.alternatives[0].message.text
|
text = completion_response.alternatives[0].message.text
|
||||||
if stop is not None:
|
if stop is not None:
|
||||||
text = enforce_stop_tokens(text, stop)
|
text = enforce_stop_tokens(text, stop)
|
||||||
return text
|
return text
|
||||||
|
Loading…
Reference in New Issue
Block a user