You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Bedrock count_tokens support plus usage-limit coverage
- Wire BedrockConverseModel.count_tokens to the Bedrock Runtime count_tokens API and reuse the converse payload builder for both count and inference calls.
- Update pytest cassettes + dependency floor so Bedrock token preflight can run with real responses, and add a CLI helper for capturing new recordings.
- Add usage-limit tests (with fresh VCR data) and a small unit test for _remove_inference_geo_prefix to keep the behavior covered once the new count flow is exercised.
- text: "I notice there's a small typo in your message - it should be \"lazy dog\" (two words) rather than \"lazydog.\"\n\nThe corrected version is: \"The quick brown fox jumps over the lazy dog.\"\n\nThis is a famous pangram - a sentence that contains every letter of the English alphabet at least once. It's commonly used for testing typewriters, keyboards, fonts, and other applications where you want to display all the letters.\n\nIs there something specific you'd like to know about this phrase, or were you perhaps testing something?"
result=awaitagent.run(['What is the main content on this document?', text_document_url])
545
-
assertresult.output==snapshot("""\
546
-
Based on the text in the <document_content> tag, the main content of this document appears to be:
597
+
assertresult.output==snapshot(
598
+
"""\
599
+
Based on the text in the <document_content> tag, the main content of this document appears to be:
547
600
548
-
An example text describing the use of "John Doe" as a placeholder name in legal cases, hospitals, and other contexts where a party's real identity is unknown or needs to be withheld. It provides background on how "John Doe" and "Jane Doe" are commonly used in the United States and Canada for this purpose, in contrast to other English speaking countries that use names like "Joe Bloggs". The text gives examples of using John/Jane Doe for legal cases, unidentified corpses, and as generic names on forms. It also mentions how "Baby Doe" and "Precious Doe" are used for unidentified children.\
549
-
""")
601
+
An example text describing the use of "John Doe" as a placeholder name in legal cases, hospitals, and other contexts where a party's real identity is unknown or needs to be withheld. It provides background on how "John Doe" and "Jane Doe" are commonly used in the United States and Canada for this purpose, in contrast to other English speaking countries that use names like "Joe Bloggs". The text gives examples of using John/Jane Doe for legal cases, unidentified corpses, and as generic names on forms. It also mentions how "Baby Doe" and "Precious Doe" are used for unidentified children.\
text_content=BinaryContent(data=b'This is a test document.', media_type='text/plain')
558
612
559
613
result=awaitagent.run(['What is the main content on this document?', text_content])
560
-
assertresult.output==snapshot("""\
561
-
The document you're referring to appears to be a test document, which means its primary purpose is likely to serve as an example or a placeholder rather than containing substantive content. Test documents are commonly used for various purposes such as:
614
+
assertresult.output==snapshot(
615
+
"""\
616
+
The document you're referring to appears to be a test document, which means its primary purpose is likely to serve as an example or a placeholder rather than containing substantive content. Test documents are commonly used for various purposes such as:
562
617
563
-
1. **Software Testing**: To verify that a system can correctly handle, display, or process documents.
564
-
2. **Design Mockups**: To illustrate how a document might look in a particular format or style.
565
-
3. **Training Materials**: To provide examples for instructional purposes.
566
-
4. **Placeholders**: To fill space in a system or application where real content will eventually be placed.
618
+
1. **Software Testing**: To verify that a system can correctly handle, display, or process documents.
619
+
2. **Design Mockups**: To illustrate how a document might look in a particular format or style.
620
+
3. **Training Materials**: To provide examples for instructional purposes.
621
+
4. **Placeholders**: To fill space in a system or application where real content will eventually be placed.
567
622
568
-
Since this is a test document, it probably doesn't contain any meaningful or specific information beyond what is necessary to serve its testing purpose. If you have specific questions about the format, structure, or any particular element within the document, feel free to ask!\
569
-
""")
623
+
Since this is a test document, it probably doesn't contain any meaningful or specific information beyond what is necessary to serve its testing purpose. If you have specific questions about the format, structure, or any particular element within the document, feel free to ask!\
result=awaitagent.run('What is the largest city in the user country?')
1094
-
assertresult.output==snapshot("""\
1095
-
Based on your location in Mexico, the largest city is Mexico City (Ciudad de México). It's not only the capital but also the most populous city in Mexico with a metropolitan area population of over 21 million people, making it one of the largest urban agglomerations in the world.
1150
+
assertresult.output==snapshot(
1151
+
"""\
1152
+
Based on your location in Mexico, the largest city is Mexico City (Ciudad de México). It's not only the capital but also the most populous city in Mexico with a metropolitan area population of over 21 million people, making it one of the largest urban agglomerations in the world.
1096
1153
1097
-
Mexico City is an important cultural, financial, and political center for the country and has a rich history dating back to the Aztec empire when it was known as Tenochtitlán.\
1098
-
""")
1154
+
Mexico City is an important cultural, financial, and political center for the country and has a rich history dating back to the Aztec empire when it was known as Tenochtitlán.\
0 commit comments