Loading knowledge files in assistant on the fly

I did some experimenting on this using the console. While I was in the thread of a conversation i loaded the information about a certain car and asked questions but it couldn’t pick it up. I had to create a new thread before it was aware of the knowledge file. I know I can just call it in a function but I’m trying to minimize function calls for speed as it would be on a voice call.

When a user dials a certain phone number i know the car they are calling about and I just wanted to have it preloaded as knowledge so if they ask 10 questions I dont need to make completion calls on the fly. The assistant would already have the information as i loaded it when the call connected. If that makes sense… it would just be nice performance hack. Anyone try something like this?

When you create a run, you can inject additional information about the user or anything in there. Is this what you tested?

const run = await openai.beta.threads.runs.create(
                assistant_id: process.env.OPENAI_ASSISTANT_ID,
                instructions: `Please address the user as ${user_name}. They are inquiring about ${car_query}.`

I was adding the file while in a conversation but it wouldn’t consume it. When i started a new thread it was aware of the file. I want to dynamically load a knowledge file on the fly mid thread but doesn’t seem that it works. Would be great to have all the possible data available on that car already in the knowledge base and i delete the file at the end of the converstion.

This way avoid making 20 function calls to answers. It just knows the answer from the file. If that makes sense

You can try:


The general idea is that

  1. API developers aren’t the only user
  2. If you have knowledge that is in a semantic database, it can always be recalled if it is relevant.

of course

a. If the assistant backend has files attached, it’s going to load up the AI model with all the tokens it can regardless of the relevance.