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

Example upload file #47

Open
terralogia opened this issue Aug 17, 2024 · 4 comments
Open

Example upload file #47

terralogia opened this issue Aug 17, 2024 · 4 comments

Comments

@terralogia
Copy link

Congratulations on the library!

Could you provide an example of how to upload a PDF to the OpenAI API and get a text summary of the content of the PDF?

@HemulGM
Copy link
Owner

HemulGM commented Aug 17, 2024

@terralogia
Copy link
Author

Good, but

Write code ...

OpenAI := TOpenAI.Create;
OpenAI.Token := 'apikey';
OpenAI.BaseURL := 'https://api.openai.com/v1/';

fil := OpenAI.&File.Upload(
procedure (para : TFileUploadParams)
begin
para.Purpose('assistants');
para.&File('file.pdf');

end

);

ast := TAssistantTool.Create;
ast.Add('type', 'code_interpreter');

// Runtime error ... Any idea?
asi := OpenAI.Assistants.Create(procedure(params : TAssistantParams)
begin
params.Instructions('Write resume file pdf');
params.Tools([ast]);
params.FileIds(varArrayOf([fil.Id]));
end);

@HemulGM
Copy link
Owner

HemulGM commented Aug 17, 2024

It's abstract class
image

@HemulGM
Copy link
Owner

HemulGM commented Aug 17, 2024

I have updated this part. Pull the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants