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

feat: Add support for different content types in Assistants API and other fixes #412

Merged
merged 1 commit into from
May 11, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented May 11, 2024

Adds support for different content types. E.g.

CreateMessageRequestContent.text: for a string content

final res = await client.createThreadMessage(
  threadId: threadId,
  request: const CreateMessageRequest(
    role: MessageRole.user,
    content: CreateMessageRequestContent.text(
      'I need to solve the equation `3x + 11 = 14`. Can you help me?',
    ),
  ),
);

CreateMessageRequestContent.parts: for content that includes text, image URLs or image files

final res = await client.createThreadMessage(
  threadId: threadId,
  request: CreateMessageRequest(
    role: CreateMessageRequestRole.user,
    content: CreateMessageRequestContent.parts([
      MessageContent.text(
        text: MessageContentText(
          value: 'Some text...', 
        ),
      ),
      MessageContent.imageFile(
        imageFile: MessageContentImageFile(fileId: 'file-abc123'),
      ),
      MessageContent.imageUrl(
        imageUrl: MessageContentImageUrl(
          url: 'https://example.com/image.jpg',
        ),
      ),
    ]),
  ),
);

This PR also fixes:

@davidmigloz davidmigloz self-assigned this May 11, 2024
@davidmigloz davidmigloz added t:enhancement New feature or request p:openai_dart openai_dart package. labels May 11, 2024
@davidmigloz davidmigloz added this to the v0.8.0 milestone May 11, 2024
@davidmigloz davidmigloz merged commit 97acab4 into main May 11, 2024
1 check passed
@davidmigloz davidmigloz deleted the assistants-v3 branch May 11, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:openai_dart openai_dart package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

OpenAI listVectorStoreFiles throw an error if the list is empty OpenAI createVectorStore throw an exception
1 participant