Skip to content

Commit 471c452

Browse files
chore(docs): update file uploads in README (#333)
1 parent c5077a1 commit 471c452

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -581,26 +581,26 @@ The file name and content-type can be customized by implementing `Name() string`
581581
string` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a
582582
file returned by `os.Open` will be sent with the file name on disk.
583583

584-
We also provide a helper `openai.FileParam(reader io.Reader, filename string, contentType string)`
584+
We also provide a helper `openai.File(reader io.Reader, filename string, contentType string)`
585585
which can be used to wrap any `io.Reader` with the appropriate file name and content type.
586586

587587
```go
588588
// A file from the file system
589589
file, err := os.Open("input.jsonl")
590590
openai.FileNewParams{
591-
File: openai.F[io.Reader](file),
591+
File: file,
592592
Purpose: openai.FilePurposeFineTune,
593593
}
594594

595595
// A file from a string
596596
openai.FileNewParams{
597-
File: openai.F[io.Reader](strings.NewReader("my file contents")),
597+
File: strings.NewReader("my file contents"),
598598
Purpose: openai.FilePurposeFineTune,
599599
}
600600

601601
// With a custom filename and contentType
602602
openai.FileNewParams{
603-
File: openai.FileParam(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
603+
File: openai.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
604604
Purpose: openai.FilePurposeFineTune,
605605
}
606606
```

0 commit comments

Comments
 (0)