Follow-up from #533: turns are still parsed incorrectly when streaming with chat_snowflake():
> chat <- chat_snowflake(model = "claude-3-7-sonnet")
> chat$chat("Briefly list your favourite SQL dialects.")
# My Favorite SQL Dialects
1. PostgreSQL - Robust, ACID-compliant, with excellent JSON support and advanced features
2. SQLite - Lightweight, serverless, perfect for embedded applications
3. MySQL/MariaDB - Popular, good performance, widely supported
4. Microsoft SQL Server - Strong enterprise features and integration with Microsoft ecosystem
5. BigQuery SQL - Great for analytics on large datasets
Each has strengths for different use cases, from embedded applications to enterprise data warehousing.
> chat$last_turn()@text
[1] "#"
Peeking at chat$last_turn()@json seems to indicate that we might not be parsing the deltas correctly:
Full str() output
> > chat$last_turn()@json |> str()
List of 4
$ id : chr "bac82de4-daeb-4cf5-b335-04b417d7e30b"
$ model : chr "claude-3-7-sonnet"
$ choices:List of 47
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "#"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "#"
.. .. ..$ text : chr "#"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " My"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " My"
.. .. ..$ text : chr " My"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " Favorite SQL"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " Favorite SQL"
.. .. ..$ text : chr " Favorite SQL"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " Dialects\n\n1"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " Dialects\n\n1"
.. .. ..$ text : chr " Dialects\n\n1"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ". Postgre"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ". Postgre"
.. .. ..$ text : chr ". Postgre"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "SQL -"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "SQL -"
.. .. ..$ text : chr "SQL -"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " Robust"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " Robust"
.. .. ..$ text : chr " Robust"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ", ACID-compliant"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ", ACID-compliant"
.. .. ..$ text : chr ", ACID-compliant"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ", with"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ", with"
.. .. ..$ text : chr ", with"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " excellent JSON"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " excellent JSON"
.. .. ..$ text : chr " excellent JSON"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " support an"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " support an"
.. .. ..$ text : chr " support an"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "d advanced features"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "d advanced features"
.. .. ..$ text : chr "d advanced features"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "\n2. SQL"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "\n2. SQL"
.. .. ..$ text : chr "\n2. SQL"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "ite - Lightweight"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "ite - Lightweight"
.. .. ..$ text : chr "ite - Lightweight"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ", server"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ", server"
.. .. ..$ text : chr ", server"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "less, perfect"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "less, perfect"
.. .. ..$ text : chr "less, perfect"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " for embedded applications"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " for embedded applications"
.. .. ..$ text : chr " for embedded applications"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "\n3. MySQL"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "\n3. MySQL"
.. .. ..$ text : chr "\n3. MySQL"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "/"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "/"
.. .. ..$ text : chr "/"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "MariaDB -"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "MariaDB -"
.. .. ..$ text : chr "MariaDB -"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " Popular"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " Popular"
.. .. ..$ text : chr " Popular"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ", goo"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ", goo"
.. .. ..$ text : chr ", goo"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "d performance"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "d performance"
.. .. ..$ text : chr "d performance"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr ", widely"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ", widely"
.. .. ..$ text : chr ", widely"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " supporte"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " supporte"
.. .. ..$ text : chr " supporte"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "d\n4. Microsoft"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "d\n4. Microsoft"
.. .. ..$ text : chr "d\n4. Microsoft"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " SQL Server - Strong"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " SQL Server - Strong"
.. .. ..$ text : chr " SQL Server - Strong"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " enterprise"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " enterprise"
.. .. ..$ text : chr " enterprise"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " features"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " features"
.. .. ..$ text : chr " features"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " an"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " an"
.. .. ..$ text : chr " an"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "d integration"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "d integration"
.. .. ..$ text : chr "d integration"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " with Microsoft"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " with Microsoft"
.. .. ..$ text : chr " with Microsoft"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " ecosystem"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " ecosystem"
.. .. ..$ text : chr " ecosystem"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "\n5. Big"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "\n5. Big"
.. .. ..$ text : chr "\n5. Big"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "Query SQL"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "Query SQL"
.. .. ..$ text : chr "Query SQL"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " - Great"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " - Great"
.. .. ..$ text : chr " - Great"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " for analytics"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " for analytics"
.. .. ..$ text : chr " for analytics"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " on"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " on"
.. .. ..$ text : chr " on"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " large datasets"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " large datasets"
.. .. ..$ text : chr " large datasets"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "\n\nEach has streng"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "\n\nEach has streng"
.. .. ..$ text : chr "\n\nEach has streng"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "ths for"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "ths for"
.. .. ..$ text : chr "ths for"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " different use cases,"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " different use cases,"
.. .. ..$ text : chr " different use cases,"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " from embedde"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " from embedde"
.. .. ..$ text : chr " from embedde"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "d applications to enterprise"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "d applications to enterprise"
.. .. ..$ text : chr "d applications to enterprise"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr " data wareho"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr " data wareho"
.. .. ..$ text : chr " data wareho"
..$ :List of 1
.. ..$ delta:List of 4
.. .. ..$ type : chr "text"
.. .. ..$ content : chr "using."
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr "using."
.. .. ..$ text : chr "using."
..$ :List of 1
.. ..$ delta:List of 3
.. .. ..$ type : chr "text"
.. .. ..$ content_list:List of 1
.. .. .. ..$ :List of 2
.. .. .. .. ..$ type: chr "text"
.. .. .. .. ..$ text: chr ""
.. .. ..$ text : chr ""
$ usage :List of 3
..$ prompt_tokens : int 16
..$ completion_tokens: int 113
..$ total_tokens : int 129
Follow-up from #533: turns are still parsed incorrectly when streaming with
chat_snowflake():Peeking at
chat$last_turn()@jsonseems to indicate that we might not be parsing the deltas correctly:Full str() output