langchain/libs/partners
Ruben Hakopian 96b5711a0c
google-vertexai[patch]: Fixed SafetySettings handling in streaming API in VertexAI (#17278)
The streaming API doesn't separate safety_settings from the
generation_config payload. As the result the following error is observed
when using `stream` API. The functionality is correct with `invoke` API.

The fix separates the `safety_settings` from params and sets it as
argument to the `send_message` method.

```
ERROR:         Unknown field for GenerationConfig: safety_settings
Traceback (most recent call last):
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 250, in stream
    raise e
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 234, in stream
    for chunk in self._stream(
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/langchain_google_vertexai/chat_models.py", line 501, in _stream
    for response in responses:
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 921, in _send_message_streaming
    for chunk in stream:
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 514, in _generate_content_streaming
    request = self._prepare_request(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 256, in _prepare_request
    gapic_generation_config = gapic_content_types.GenerationConfig(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/chatbot-worker-main-Ju-qIM-X-py3.12/lib/python3.12/site-packages/proto/message.py", line 576, in __init__
    raise ValueError(
ValueError: Unknown field for GenerationConfig: safety_settings
```

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-02-08 17:25:28 -08:00
..
anthropic anthropic[patch]: Fix message type lookup in Anthropic Partners (#16563) 2024-01-25 09:17:59 -08:00
exa exa: init pkg (#16553) 2024-01-24 20:57:17 -07:00
google-genai google-genai[patch]: added parsing of function call / response (#17245) 2024-02-08 13:34:46 -08:00
google-vertexai google-vertexai[patch]: Fixed SafetySettings handling in streaming API in VertexAI (#17278) 2024-02-08 17:25:28 -08:00
mistralai mistralai[patch]: release 0.0.4 (#17139) 2024-02-06 16:05:20 -08:00
nomic nomic: init pkg (#16853) 2024-01-31 16:46:35 -08:00
nvidia-ai-endpoints nvidia-ai-endpoints[patch]: release 0.0.2 (#17125) 2024-02-06 12:48:25 -08:00
nvidia-trt nvidia-trt[patch]: propagate InferenceClientException to the caller. (#16936) 2024-02-06 11:47:07 -08:00
openai langchain[patch]: expose cohere rerank score, add parent doc param (#16887) 2024-02-08 16:07:18 -08:00
pinecone pinecone[patch]: integration test new namespace (#17121) 2024-02-06 11:56:00 -08:00
robocorp robocorp: release 0.0.3 (#16789) 2024-01-30 07:15:25 -08:00
together partners: add license field (#16117) 2024-01-17 08:37:13 -08:00