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

Create Message Request Content #619

Open
12 tasks
andreiavornic opened this issue Dec 12, 2024 · 0 comments
Open
12 tasks

Create Message Request Content #619

andreiavornic opened this issue Dec 12, 2024 · 0 comments
Assignees
Labels
p:openai_dart openai_dart package. t:bug Something isn't working

Comments

@andreiavornic
Copy link

andreiavornic commented Dec 12, 2024

System Info

Dart

Related Components

  • doc-loaders
  • doc-transformers
  • prompts
  • llms
  • chat-models
  • output-parsers
  • chains
  • memory
  • stores
  • embeddings
  • retrievers
  • agents

Reproduction

Future<void> createImageMessage(String message) async {
  print(message);
  await _client.createThreadMessage(
    threadId: _threadId,
    request: CreateMessageRequest(
      role: MessageRole.user,
      content: CreateMessageRequestContent.parts([
        MessageContent.text(
          text: MessageContentText(
            value: message,
          ),
        ),
        const MessageContent.imageUrl(
          imageUrl: MessageContentImageUrl(
            url: 'https://example.com/image.jpg', // or base64-encoded image
          ),
        ),
      ]),
    ),
  );
  final stream = _client.createThreadRunStream(
    threadId: _threadId,
    request: CreateRunRequest(
      assistantId: _assistantId,
    ),
  );
  stream.listen(runListener);
}

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: OpenAIClientException({
  "uri": "https://api.openai.com/v1/threads/thread_*******/messages",
  "method": "POST",
  "code": 400,
  "message": "Unsuccessful response",
  "body": {
    "error": {
      "message": "Invalid type for 'content[0].text': expected a string, but got an object instead.",
      "type": "invalid_request_error",
      "param": "content[0].text",
      "code": "invalid_type"
    }
  }
})

Expected behavior

Create ThreadRunStream

@andreiavornic andreiavornic added the t:bug Something isn't working label Dec 12, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in LangChain.dart Dec 12, 2024
@davidmigloz davidmigloz added the p:openai_dart openai_dart package. label Dec 21, 2024
@davidmigloz davidmigloz self-assigned this Dec 21, 2024
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:bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants