@@ -48,6 +48,10 @@ type EvaluationResult struct {
4848 Details string `json:"details,omitempty"`
4949}
5050
51+ type Organization struct {
52+ Name string `json:"name"`
53+ }
54+
5155var FailedTests = errors .New ("❌ Some tests failed." )
5256
5357// NewEvalCommand returns a new command to evaluate prompts against models
@@ -66,7 +70,7 @@ func NewEvalCommand(cfg *command.Config) *cobra.Command {
6670
6771 Example prompt.yml structure:
6872 name: My Evaluation
69- model: gpt-4o
73+ model: openai/ gpt-4o
7074 testData:
7175 - input: "Hello world"
7276 expected: "Hello there"
@@ -94,6 +98,9 @@ func NewEvalCommand(cfg *command.Config) *cobra.Command {
9498 return err
9599 }
96100
101+ // Get the org flag
102+ org , _ := cmd .Flags ().GetString ("org" )
103+
97104 // Load the evaluation prompt file
98105 evalFile , err := loadEvaluationPromptFile (promptFilePath )
99106 if err != nil {
@@ -106,6 +113,7 @@ func NewEvalCommand(cfg *command.Config) *cobra.Command {
106113 client : cfg .Client ,
107114 evalFile : evalFile ,
108115 jsonOutput : jsonOutput ,
116+ org : org ,
109117 }
110118
111119 err = handler .runEvaluation (cmd .Context ())
@@ -120,6 +128,7 @@ func NewEvalCommand(cfg *command.Config) *cobra.Command {
120128 }
121129
122130 cmd .Flags ().Bool ("json" , false , "Output results in JSON format" )
131+ cmd .Flags ().String ("org" , "" , "Organization to attribute usage to (omitting will attribute usage to the current actor" )
123132 return cmd
124133}
125134
@@ -128,6 +137,7 @@ type evalCommandHandler struct {
128137 client azuremodels.Client
129138 evalFile * prompt.File
130139 jsonOutput bool
140+ org string
131141}
132142
133143func loadEvaluationPromptFile (filePath string ) (* prompt.File , error ) {
@@ -321,7 +331,7 @@ func (h *evalCommandHandler) templateString(templateStr string, data map[string]
321331func (h * evalCommandHandler ) callModel (ctx context.Context , messages []azuremodels.ChatMessage ) (string , error ) {
322332 req := h .evalFile .BuildChatCompletionOptions (messages )
323333
324- resp , err := h .client .GetChatCompletionStream (ctx , req )
334+ resp , err := h .client .GetChatCompletionStream (ctx , req , h . org )
325335 if err != nil {
326336 return "" , err
327337 }
@@ -460,7 +470,7 @@ func (h *evalCommandHandler) runLLMEvaluator(ctx context.Context, name string, e
460470 Stream : false ,
461471 }
462472
463- resp , err := h .client .GetChatCompletionStream (ctx , req )
473+ resp , err := h .client .GetChatCompletionStream (ctx , req , h . org )
464474 if err != nil {
465475 return EvaluationResult {}, fmt .Errorf ("failed to call evaluation model: %w" , err )
466476 }
0 commit comments