Compare commits

...

8 Commits

Author SHA1 Message Date
Bagatur
e3200aded4 rm test release condition 2023-11-22 17:14:37 -08:00
Bagatur
85bc681b96 rm 2023-11-22 17:05:41 -08:00
Bagatur
181112c85e 340 2023-11-22 15:15:49 -08:00
Bagatur
53aa1a1f62 bump 2023-11-22 15:11:26 -08:00
Bagatur
6cb2d9305c bugfix: tool message to string 2023-11-22 15:10:26 -08:00
dandanwei
771ad1fe52 BUGFIX: redis vector store overwrites falsey metadata (#13652)
- **Description:** This commit fixed the problem that Redis vector store
will change the value of a metadata from 0 to empty when saving the
document, which should be an un-intended behavior.
  - **Issue:** N/A
  - **Dependencies:** N/A
2023-11-22 15:09:14 -08:00
David Ruan
3f291a4952 BUGFIX: Update bedrock.py to fix provider bug (#13646)
Provider check was incorrectly failing for anything other than "meta"
2023-11-22 15:08:25 -08:00
Erick Friis
625576fec7 BUGFIX: anthropic models on bedrock (#13629)
Introduced in #13403
2023-11-22 15:07:58 -08:00
7 changed files with 23 additions and 5 deletions

View File

@@ -14,7 +14,6 @@ env:
jobs:
build:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
outputs:

View File

@@ -14,7 +14,6 @@ env:
jobs:
build:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
outputs:

View File

@@ -27,7 +27,7 @@ class ChatPromptAdapter:
) -> str:
if provider == "anthropic":
prompt = convert_messages_to_prompt_anthropic(messages=messages)
if provider == "meta":
elif provider == "meta":
prompt = convert_messages_to_prompt_llama(messages=messages)
else:
raise NotImplementedError(

View File

@@ -46,6 +46,8 @@ def get_buffer_string(
role = "System"
elif isinstance(m, FunctionMessage):
role = "Function"
elif isinstance(m, ToolMessage):
role = "Tool"
elif isinstance(m, ChatMessage):
role = m.role
else:

View File

@@ -1381,7 +1381,7 @@ def _prepare_metadata(metadata: Dict[str, Any]) -> Dict[str, Any]:
clean_meta: Dict[str, Union[str, float, int]] = {}
for key, value in metadata.items():
if not value:
if value is None:
clean_meta[key] = ""
continue

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain"
version = "0.0.339"
version = "0.0.340"
description = "Building applications with LLMs through composability"
authors = []
license = "MIT"

View File

@@ -1,8 +1,10 @@
"""Test Anthropic Chat API wrapper."""
from typing import List
from unittest.mock import MagicMock
import pytest
from langchain.chat_models import BedrockChat
from langchain.chat_models.meta import convert_messages_to_prompt_llama
from langchain.schema import AIMessage, BaseMessage, HumanMessage, SystemMessage
@@ -28,3 +30,19 @@ from langchain.schema import AIMessage, BaseMessage, HumanMessage, SystemMessage
def test_formatting(messages: List[BaseMessage], expected: str) -> None:
result = convert_messages_to_prompt_llama(messages)
assert result == expected
def test_anthropic_bedrock() -> None:
client = MagicMock()
respbody = MagicMock(
read=MagicMock(
return_value=MagicMock(
decode=MagicMock(return_value=b'{"completion":"Hi back"}')
)
)
)
client.invoke_model.return_value = {"body": respbody}
model = BedrockChat(model_id="anthropic.claude-v2", client=client)
# should not throw an error
model.invoke("hello there")