MCPcopy
hub / github.com/openai/openai-python / from_in_memory

Function from_in_memory

examples/uploads.py:25–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def from_in_memory() -> None:
26 print("uploading file from memory")
27
28 # read the data into memory ourselves to simulate
29 # it coming from somewhere else
30 data = file.read_bytes()
31 filename = "my_file.txt"
32
33 upload = client.uploads.upload_file_chunked(
34 file=data,
35 filename=filename,
36 bytes=len(data),
37 mime_type="txt",
38 purpose="batch",
39 )
40 rich.print(upload)
41
42
43if "memory" in sys.argv:

Callers 1

uploads.pyFile · 0.85

Calls 1

upload_file_chunkedMethod · 0.45

Tested by

no test coverage detected