Skip to content

models - content - documents #138

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

Merged
merged 1 commit into from
May 29, 2025
Merged

Conversation

pgrayy
Copy link
Member

@pgrayy pgrayy commented May 28, 2025

Description

Add document support to OpenAI and LiteLLM model providers.

Related Issues

strands-agents/tools#53

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all
  • Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
  • hatch run test-lint
  • python ./test_document.py: Wrote the following test script:
from strands import Agent
from strands.models.litellm import LiteLLMModel

with open("cat.wikipedia.page1.pdf", "rb") as fp:
    doc = fp.read()

agent = Agent(
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "document": {
                        "format": "pdf",
                        "name": "test doc",
                        "source": {
                            "bytes": doc,
                        },
                    },
                },
            ],
        },
    ],
    model=LiteLLMModel(model_id="us.anthropic.claude-3-7-sonnet-20250219-v1:0")
)
agent("Can you summarize the provided document?")

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pgrayy pgrayy merged commit 58bfecb into strands-agents:main May 29, 2025
20 checks passed
@pgrayy pgrayy deleted the documents branch May 29, 2025 03:11
jer96 pushed a commit to lukehau/sdk-python that referenced this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants