Skip to content

Commit

Permalink
Missed some renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 10, 2024
1 parent 31c8fdc commit efd39a3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ chat.chat("What is the capital of France?", echo="all")

This shows important information like tool call results, finish reasons, and more.

If the problem isn't self-evident, you can also reach into the `.last_turn()`, which contains the full response object, with full details about the completion.
If the problem isn't self-evident, you can also reach into the `.get_last_turn()`, which contains the full response object, with full details about the completion.


<div style="display:flex;justify-content:center;">
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/Chat.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You should generally not create this object yourself, but instead call
| [console](#chatlas.Chat.console) | Enter a chat console to interact with the LLM. |
| [extract_data](#chatlas.Chat.extract_data) | Extract structured data from the given input. |
| [extract_data_async](#chatlas.Chat.extract_data_async) | Extract structured data from the given input asynchronously. |
| [last_turn](#chatlas.Chat.last_turn) | Get the last turn in the chat with a specific role. |
| [get_last_turn](#chatlas.Chat.get_last_turn) | Get the last turn in the chat with a specific role. |
| [register_tool](#chatlas.Chat.register_tool) | Register a tool (function) with the chat. |
| [set_turns](#chatlas.Chat.set_turns) | Set the turns of the chat. |
| [tokens](#chatlas.Chat.tokens) | Get the tokens for each turn in the chat. |
Expand Down Expand Up @@ -158,7 +158,7 @@ Extract structured data from the given input asynchronously.
|--------|-----------------------------------------------------|---------------------|
| | [dict](`dict`)\[[str](`str`), [Any](`typing.Any`)\] | The extracted data. |

### last_turn { #chatlas.Chat.last_turn }
### get_last_turn { #chatlas.Chat.get_last_turn }

```python
Chat.get_last_turn(role='assistant')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_provider_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def test_anthropic_simple_streaming_request():
async for x in foo:
res.append(x)
assert "2" in "".join(res)
turn = chat.last_turn()
turn = chat.get_last_turn()
assert turn is not None
assert turn.finish_reason == "end_turn"

Expand Down
3 changes: 1 addition & 2 deletions tests/test_provider_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import time

import pytest

from chatlas import ChatGoogle

from .conftest import (
Expand Down Expand Up @@ -41,7 +40,7 @@ async def test_google_simple_streaming_request():
async for x in await chat.stream_async("What is 1 + 1?"):
res.append(x)
assert "2" in "".join(res)
turn = chat.last_turn()
turn = chat.get_last_turn()
assert turn is not None
assert turn.finish_reason == "STOP"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_provider_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def test_openai_simple_streaming_request():
async for x in await chat.stream_async("What is 1 + 1?"):
res.append(x)
assert "2" in "".join(res)
turn = chat.last_turn()
turn = chat.get_last_turn()
assert turn is not None
assert turn.finish_reason == "stop"

Expand Down

0 comments on commit efd39a3

Please sign in to comment.