Skip to content

OpenAI instructions not set correctly #1501

Closed
@ag14774

Description

@ag14774

Initial Checks

Description

Hello team,

So I've played around with the new instructions feature and from my tests and from reading the code, it seems to me that the instruction is only applied to the first LLM call. Even within a single .run, if there is a tool call, upon returning back from the tool call, the instruction will no longer be applied. Is this intented behavior? I think this is because instructions are extracted by looping the messages in reverse, and since there is a new request made by the tool, it no longer finds the instruction.

Example Code

Python, Pydantic AI & LLM client version

Python 3.12
Pydantic 0.1
OpenAI completions API

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions