I’m fairly new to this, so bear with me
I created an assistant on the OpenAI platform V2. The assistants role is to correct and give feedback to answers/submissions from the users.
I uploaded a PDF document as file attachement to the assistant as a knowledge base, and I used the default settings for Chunk size and Chunk overlap:
When I ran two tests to see how the assistant would give feedback, I noticed that it used a lot of tokens to produce these answers, as you can see in the upper right corner of the image below (text is in Norwegian btw)
Input tokens: 10663
Output tokens: 177
Does that means that the text in the attached PDF will count as input tokens each time the assistant search it?
I’m just testing this right now, but eventually I will use the assistant on my SaaS, and if my two inputs produced over 10000 tokens I’m afraid that this will be very expensive in terms of tokens when applied to the live version of my app.
I must be doing something wrong here, and I would be very happy for some help on this matter
1 Like
It looks like your assistant is functioning as intended, especially if it needs to provide accurate and contextually relevant feedback based on the content of the PDF. Here’s a breakdown of what’s happening:
-
When you upload a document as a knowledge base, the assistant needs to process the entire document (or relevant chunks) to give correct responses. This means the text from the PDF is counted as input tokens each time the assistant references it.
-
The high number of input tokens you’re seeing is because the assistant is ‘reading’ through the content to provide accurate feedback. This is standard behavior to ensure the responses are contextually relevant.
-
Experiment with adjusting the chunk size and overlap settings to optimize token usage.
-
Consider summarizing the document to reduce the number of tokens processed per query.
What you’re experiencing is typical for setups where detailed and accurate responses are necessary.
It’s not that you’re doing anything wrong; it’s just how the assistant processes and infers information from the file.
1 Like
Thank you so much for responding and for the advice. I will go through the files to see if I can summarize them.
I have another question though, if you don’t mind.
Here is my use case:
I have built an application where I want to integrate this AI functionality that I described in my first question. Basically this is a small online Learning Management System that I developed for my work.
In each lesson the users will get a question that they need to answer to check if they understood the lesson, and the GPT assistant will evaluate their answer and give a feedback to the user.
I know how to connect my application to my OpenAI throug an API call, but how can I connect to this very assistant that has the PDF uploaded with the spesific content of the lesson?
Does the assistant have it’s own API key and/or is there an assistant ID that I have to reference in the API call?
I can’t seem to figure this out…
1 Like
You’re right → you just need to reference the Assistant ID in your API call to connect to the specific assistant with the PDF content.
Each assistant has its own unique ID, which you can find on the OpenAI platform. Include that ID in your API request to ensure the correct assistant evaluates the user’s answers.
1 Like
Perfect! Thank you so much!
1 Like