Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to reuse stream parsing across ChatModels #380

Merged
merged 42 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9ad1c7f
Copy discard_none_arguments to LitellmChatModel
jackmpcollins Nov 18, 2024
93d6cfd
Switch OpenaiChatModel to use Stream approach
jackmpcollins Nov 19, 2024
a7ec635
Add TODO to test retry logic
jackmpcollins Nov 20, 2024
02a05ec
Add StreamParser to DRY openai streaming code
jackmpcollins Nov 20, 2024
a097c2a
Add _if_given
jackmpcollins Nov 21, 2024
f4bb4c1
Fix typing for openai Stream classes
jackmpcollins Nov 23, 2024
8ccd016
Add parse_stream and use in OpenaiChatModel
jackmpcollins Nov 23, 2024
eeb765e
tidy function schema matching
jackmpcollins Nov 23, 2024
360211e
Copy Stream classes into stream.py
jackmpcollins Nov 23, 2024
6fa7cdd
Switch LitellmChatModel to use stream parsers
jackmpcollins Nov 23, 2024
f758536
Switch OpenaiChatModel to use shared streaming classes
jackmpcollins Nov 23, 2024
45074a5
Add docstring for is_instance_origin
jackmpcollins Nov 23, 2024
990c03f
Merge branch 'main' into use-streaming-events
jackmpcollins Nov 24, 2024
4f37190
Use type origins in parse_stream
jackmpcollins Nov 24, 2024
45b8799
Fix complete type hints for LitellmChatModel
jackmpcollins Nov 24, 2024
f8b92a4
Change function_schemas type list -> Iterable
jackmpcollins Nov 24, 2024
6b464dd
Add StreamState and OpenaiStreamState
jackmpcollins Nov 25, 2024
b073258
Add TODOs
jackmpcollins Nov 25, 2024
f6f55c3
Update openai retry test cassettes
jackmpcollins Nov 25, 2024
7478c9a
Add back usage for OpenaiChatModel
jackmpcollins Nov 25, 2024
5ca69cb
Consolodate parsers into one
jackmpcollins Nov 26, 2024
4b98d25
Make LitellmChatModel use new parsing format
jackmpcollins Nov 27, 2024
4fd7b4b
Fix litellm_ollama
jackmpcollins Nov 27, 2024
7e7e64b
Handle multiple tools in a chunk, for Mistral
jackmpcollins Nov 27, 2024
cfa0815
Remove anthropic context manager usage
jackmpcollins Nov 27, 2024
ab407b4
Add _if_given helper for anthropic
jackmpcollins Nov 27, 2024
9ab2265
Allow parser.get_content to return None
jackmpcollins Nov 27, 2024
b414c08
Switch AnthropicChatModel to new parsing logic
jackmpcollins Nov 27, 2024
f507027
Delete unused validate_str_content functions
jackmpcollins Nov 27, 2024
8f8e3d4
Remove redundant TODOs
jackmpcollins Nov 27, 2024
647e362
Fix prompt_chain and unskip tests
jackmpcollins Nov 27, 2024
ac4f27c
Only yield tool call args if not falsy
jackmpcollins Nov 27, 2024
56974ef
Add FunctionCallNotAllowedError, ObjectNotAllowedError
jackmpcollins Nov 27, 2024
c4b73e9
Add UnknownToolError, raise in OutputStream
jackmpcollins Nov 29, 2024
b964aad
Remove done todo for unknown tool call
jackmpcollins Nov 29, 2024
6b408fd
Remove is_content_ended if favor of is_tool_call
jackmpcollins Nov 29, 2024
cb2e565
Add typecheck to make all
jackmpcollins Nov 29, 2024
d6c7bfa
Add get_function_schemas. Fix some mypy errors
jackmpcollins Nov 29, 2024
a92217f
Tidy calculation of allow_string_output
jackmpcollins Nov 29, 2024
846be9e
Fix remaining mypy errors
jackmpcollins Nov 29, 2024
169a640
Delete is_instance_origin
jackmpcollins Nov 29, 2024
fdd14a7
Merge branch 'main' into use-streaming-events
jackmpcollins Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ docs-serve: # Build and serve the documentation
uv run mkdocs serve

.PHONY: all
all: format lint test
all: format lint typecheck test
Loading