Skip to content

Issue while using beta document source file #237

@TubbyStubby

Description

@TubbyStubby

Hi,

I was trying to use workspace documents in user message doing something like this -

    fileBlocks := []anthropic.BetaContentBlockParamUnion{}
	for _, fileId := range fileIds {
		fileBlocks = append(fileBlocks, anthropic.BetaContentBlockParamUnion{
			OfDocument: &anthropic.BetaRequestDocumentBlockParam{
				Source: anthropic.BetaRequestDocumentBlockSourceUnionParam{
					OfFile: &anthropic.BetaFileDocumentSourceParam{
						FileID: fileId,
					},
				},
				CacheControl: anthropic.NewBetaCacheControlEphemeralParam(),
			},
		})
	}

	messages := []anthropic.BetaMessageParam{
		anthropic.NewBetaUserMessage(
			fileBlocks...,
		),
		anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(prompt)),
	}

I am getting this error -

{
  type: 'error',
  error: {
    type: 'invalid_request_error',
    message: "messages.0.content.0.document.source: Input tag 'file' found using 'type' does not match any of the expected tags: 'base64', 'content', 'text', 'url'"
  },
  request_id: 'req_011CTR6XtLRRed3fcm7ad2Mr'
}

Is this not supported yet? or should the message be constructed in another way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions