-
Notifications
You must be signed in to change notification settings - Fork 220
feat: Add document creation for ChatBedrockConverse #601
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
4f4c25c
13fe759
71a21ff
b4d8238
58c7ecb
4812a05
003d288
114bc30
d648de1
1842cfc
42ce460
d757851
40241bd
5ab49f9
574c149
05730b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -65,7 +65,7 @@ | |||||
| MIME_TO_FORMAT = { | ||||||
| # Image formats | ||||||
| "image/png": "png", | ||||||
| "image/jpeg": "jpeg", | ||||||
| "image/jpeg": "jpeg", | ||||||
| "image/gif": "gif", | ||||||
| "image/webp": "webp", | ||||||
| # File formats | ||||||
|
|
@@ -465,9 +465,9 @@ class Joke(BaseModel): | |||||
| additionalModelResponseFieldPaths. | ||||||
| """ | ||||||
|
|
||||||
| supports_tool_choice_values: Optional[ | ||||||
| Sequence[Literal["auto", "any", "tool"]] | ||||||
| ] = None | ||||||
| supports_tool_choice_values: Optional[Sequence[Literal["auto", "any", "tool"]]] = ( | ||||||
| None | ||||||
| ) | ||||||
| """Which types of tool_choice values the model supports. | ||||||
|
|
||||||
| Inferred if not specified. Inferred as ('auto', 'any', 'tool') if a 'claude-3' | ||||||
|
|
@@ -512,6 +512,73 @@ def create_cache_point(cls, cache_type: str = "default") -> Dict[str, Any]: | |||||
| """ | ||||||
| return {"cachePoint": {"type": cache_type}} | ||||||
|
|
||||||
| @classmethod | ||||||
| def create_document( | ||||||
| cls, | ||||||
| name: str, | ||||||
| source: dict[str, Any], | ||||||
| context: Optional[str] = None, | ||||||
| enable_citations: Optional[bool] = False, | ||||||
| format: Optional[ | ||||||
| Literal["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"] | ||||||
| ] = None, | ||||||
| ) -> Dict[str, Any]: | ||||||
| """Create a document configuration for Bedrock. | ||||||
| Args: | ||||||
| name: The name of the document. | ||||||
| source: The source of the document. | ||||||
| context: Info for the model to understand the document for citations. | ||||||
| format: The format of the document, or its extension. | ||||||
|
Comment on lines
528
to
531
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do!
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 4812a05 |
||||||
| Returns: | ||||||
| Dictionary containing a properly formatted to add to message content.""" | ||||||
| if re.match(r"[^\w\[\]\(\)-]|[\s]{2,}", name): | ||||||
|
||||||
| if re.match(r"[^\w\[\]\(\)-]|[\s]{2,}", name): | |
| if not re.search(r"[^A-Za-z0-9 \[\]()\-]|\s{2,}", name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not was accidentally added to the front. Resolved in d757851
hatMatch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing content source currently fails because isinstance is missing the second argument for type here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops good catch thanks!
Uh oh!
There was an error while loading. Please reload this page.