Skip to content

Commit

Permalink
anthropic[patch]: de-beta anthropic messages, release 0.0.2 (#17540)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Feb 14, 2024
1 parent a99c667 commit bfaa8c3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
6 changes: 2 additions & 4 deletions libs/partners/anthropic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ all: help

# Define a variable for the test file path.
TEST_FILE ?= tests/unit_tests/
integration_test integration_tests: TEST_FILE=tests/integration_tests/

test:
poetry run pytest $(TEST_FILE)

tests:
test tests integration_test integration_tests:
poetry run pytest $(TEST_FILE)


Expand Down
10 changes: 5 additions & 5 deletions libs/partners/anthropic/langchain_anthropic/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _format_messages(messages: List[BaseMessage]) -> Tuple[Optional[str], List[D


class ChatAnthropicMessages(BaseChatModel):
"""Beta ChatAnthropicMessages chat model.
"""ChatAnthropicMessages chat model.
Example:
.. code-block:: python
Expand Down Expand Up @@ -143,7 +143,7 @@ def _stream(
**kwargs: Any,
) -> Iterator[ChatGenerationChunk]:
params = self._format_params(messages=messages, stop=stop, **kwargs)
with self._client.beta.messages.stream(**params) as stream:
with self._client.messages.stream(**params) as stream:
for text in stream.text_stream:
yield ChatGenerationChunk(message=AIMessageChunk(content=text))

Expand All @@ -155,7 +155,7 @@ async def _astream(
**kwargs: Any,
) -> AsyncIterator[ChatGenerationChunk]:
params = self._format_params(messages=messages, stop=stop, **kwargs)
async with self._async_client.beta.messages.stream(**params) as stream:
async with self._async_client.messages.stream(**params) as stream:
async for text in stream.text_stream:
yield ChatGenerationChunk(message=AIMessageChunk(content=text))

Expand All @@ -167,7 +167,7 @@ def _generate(
**kwargs: Any,
) -> ChatResult:
params = self._format_params(messages=messages, stop=stop, **kwargs)
data = self._client.beta.messages.create(**params)
data = self._client.messages.create(**params)
return ChatResult(
generations=[
ChatGeneration(message=AIMessage(content=data.content[0].text))
Expand All @@ -183,7 +183,7 @@ async def _agenerate(
**kwargs: Any,
) -> ChatResult:
params = self._format_params(messages=messages, stop=stop, **kwargs)
data = await self._async_client.beta.messages.create(**params)
data = await self._async_client.messages.create(**params)
return ChatResult(
generations=[
ChatGeneration(message=AIMessage(content=data.content[0].text))
Expand Down
20 changes: 12 additions & 8 deletions libs/partners/anthropic/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libs/partners/anthropic/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain-anthropic"
version = "0.0.1.post2"
version = "0.0.2"
description = "An integration package connecting AnthropicMessages and LangChain"
authors = []
readme = "README.md"
Expand All @@ -13,7 +13,7 @@ license = "MIT"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
langchain-core = "^0.1"
anthropic = "^0.8.0"
anthropic = ">=0.16.0,<1"

[tool.poetry.group.test]
optional = true
Expand Down

0 comments on commit bfaa8c3

Please sign in to comment.