File Management
gllm-inference | Tutorial: File Management | API Reference
What is file management?
File management is a feature that allows the language model to manage uploaded files in their server side. These files can then be used as inputs during invocations.
File management is only available for certain LM invokers. This feature can be accessed via the file attribute of the LM invoker. As an example, let's try to upload a file using GoogleLMInvoker and then use it as an input during invocation.
Init an LM Invoker
First of all, let's create a GoogleLMInvoker that we will use to manage the data store:
from dotenv import load_dotenv
load_dotenv()
from gllm_inference.lm_invoker import GoogleLMInvoker
lm_invoker = GoogleLMInvoker("gemini-2.5-flash-lite")Upload a File
Next, let's upload a file. The upload() method will output an UploadedAttachment object to be used in later operations.
from gllm_inference.schema import Attachment
file = Attachment.from_path('path/to/file.pdf')
uploaded_file = await lm_invoker.file.upload(attachment)List the Files
We can verify that the file has been successfully uploaded to the server side by using the list() method.
Invoke LM invoker with Uploaded File
Then, we can use the uploaded file as inputs during invocation.
Delete the File
Finally, if the file is no longer used, it can be deleted via the delete() method.
Last updated