-
|
Is there a way to pass additional information to an OpenAI instance similar to NOTE: I tried passing |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Adding @westey-m to help. |
Beta Was this translation helpful? Give feedback.
-
|
@jbnidev, it is possible to customize the settings passed to the underlying service. Note that OpenAI has 3 different services for inference though with different settings types for each. Via ChatOptions (the options type for the IChatClient that the ChatClientAgent is built on) you can pass a RawRepresentationFactory which would return the options type for the underlying service. Here is an example of how to do this for the Responses service: Note that ChatOptions with the custom RawRepresentationFactory can be passed via ChatClientAgentOptions when constructing the agent, or via ChatClientAgentRunOptions on a per run basis. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your response and especially the link to the example. That does appear to be exactly what I am asking about. However, I see no way to actually set the metadata. I tried: #pragma warning disable OPENAI001
CreateResponseOptions responseCreationOptions = new()
{
TruncationMode = ResponseTruncationMode.Auto,
Metadata = systemPromptTemplateParams
};
#pragma warning restore OPENAI001This gives
because There is a constructor that takes |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much. I should have seen that approach. I can confirm that your recommendation works as advertised, allowing us to simply set values in
Honestly, I do not think this is a bad experience. In fact, it always struck me as surprising that |
Beta Was this translation helpful? Give feedback.
@jbnidev, it is possible to customize the settings passed to the underlying service. Note that OpenAI has 3 different services for inference though with different settings types for each.
Via ChatOptions (the options type for the IChatClient that the ChatClientAgent is built on) you can pass a RawRepresentationFactory which would return the options type for the underlying service.
Here is an example of how to do this for the Responses service:
https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Step15_ComputerUse/Program.cs#L78-L87
Note that ChatOptions with the custom RawRepresentationFactory can be passed via ChatClientAgentOptions…