Skip to content

Conversation

@jsong468
Copy link
Contributor

Description

This PR adds a Target Registry feature for storing instances of targets to be re-used and an AIRT initializer that instantiates a wide range of commonly used targets using environment variables. These additions will be useful for the GUI as they enable us to load commonly used targets and have them ready to use.

  • TargetRegistry follows the pattern of the existing ScorerRegistry
  • The AIRTTargetInitializer is a PyRITInitializer subclass that scans environment variables and registers available targets into the TargetRegistry. No environment variables are strictly required. The supported targets include OpenAIChatTarget, OpenAIResponseTarget, RealtimeTarget, OpenAIImageTarget, OpenAITTSTarget, OpenAIVideoTarget, and PromptShieldTarget

Tests and Documentation

Unit tests for TargetRegistry added

TODO

  • Unit tests for AIRTTargetInitializer
  • Maybe notebook example in 2_instance_registry

)

@staticmethod
def _compute_identifier_hash(target: "PromptTarget") -> str:
Copy link
Contributor

@rlundeen2 rlundeen2 Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of an identifier hash, but I think if we want to add it, it should be general. I also think we should have a minor refactor while it's still early.

  1. Substitute RegistryItemMetadata to a frozen Identifier class which is in models module
  2. Have that class include the hash
  3. As we add registries, swap out our dictionary identifiers for dataclass identifiers. These should be used everywhere

I can create a PR for the Identifiers refactor, and there is a story in the backlog to do ScorerIdentifier. But I think as part of this we should move TargetIdentifier to a dataclass also

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For you, I might make a separate (prereq) PR that just converts the TargetIdentifier to the dataclass and we can get that in first as I work on the other piece.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romanlutz
Copy link
Contributor

The GUI may need to know if it's possible to set the system prompt on a target. Can we provide that information in the registry?

@jsong468
Copy link
Contributor Author

The GUI may need to know if it's possible to set the system prompt on a target. Can we provide that information in the registry?

Do you mean PromptChatTarget vs ChatTarget? This can be an attribute of the TargetMetadata possibly? @romanlutz

@romanlutz
Copy link
Contributor

The GUI may need to know if it's possible to set the system prompt on a target. Can we provide that information in the registry?

Do you mean PromptChatTarget vs ChatTarget? This can be an attribute of the TargetMetadata possibly? @romanlutz

Exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants