How can I receive meta information as argument of tool?

I am looking for a way to put(or get) meta information such as session_id, agent_id generated when creating an agent and previous conversation history as tool arguments when calling an OpenAI function call. That’s because I want a personalized system.
The best design I want is as follows.

class Input(BaseModel):
    session_id: int = Field(description="Session ID")
    agent_id: int = Field(description="Agent ID")
    history: List[str] = Field(description="Conversation history")    
    ...

@tool(args_schema=Input)
def some_function(session_id: int, agent_id: int, history: List[str], ...) -> str:
    """Do something."""
    ....

Are there some good recommendations to implement that?

1 Like

I simply inject as an extra json attribute the Thread & Run ID for every function call. That way inside my functions if I need to I can use it. (So if I needed the conversation history I could retrieve it) Most of the dozens of functions I have will never need that. So i keep it to thread/runid from which I can get whatever I need.

2 Likes