Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to Assistant, VectorStore client methods #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trrwilson
Copy link
Collaborator

  • Fixes GetAssistantAsync does not return a useful value #62 -- the remaining convenience methods in AssistantClient and VectorStoreClient have optional CancellationTokens added as method parameters, including the typed instance convenience overloads
  • Closes GetRunStepsAsync does not yet take a CancellationToken parameter #61 -- adds missing [EditorBrowsable(EditorBrowsableState.Never)] attributes to AssistantClient protocol methods, improving strongly typed convenience method discoverability
  • Addresses a yet-unreported problem with the new max_num_results property for file_search not being serialized/deserialized

public virtual Task<ClientResult> CreateMessageAsync(string threadId, BinaryContent content, RequestOptions options = null);
public virtual ClientResult<ThreadRun> CreateRun(AssistantThread thread, Assistant assistant, RunCreationOptions options = null);
public virtual ClientResult<ThreadRun> CreateRun(string threadId, string assistantId, RunCreationOptions options = null);
public virtual ClientResult<ThreadRun> CreateRun(AssistantThread thread, Assistant assistant, RunCreationOptions options = null, CancellationToken cancellationToken = default);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not exactly what I did in my PR. In my PR, I added cancellation tokens only to the most general/flexible overload. In case of this method, it would mean adding the CT only to the overload that takes string threadId and string assistantId. If the caller have AssistantThread and Assistant instances, they would simply call CreateRun(thread.Id, assistant.Id). In other words, I did not add CTs to helper overloads that simply delegate to other more general/flexible overloads.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on our conversation offline, we have decided to remove the overloads that take complex objects (such as ThreadRun run) and keep only the ones that take plain string IDs (such as string runId) in favor of exploring the option of making these models into subclients. For example, rather than having AssistantClient.CancelRun(ThreadRun run), we could instead have ThreadRun.Cancel().

With these overloads gone, Kryzsztof's concern here will be addressed too.

@@ -879,6 +890,7 @@ namespace OpenAI.Chat {
public ChatFunctionCall FunctionCall { get; init; }
public string ParticipantName { get; init; }
public IList<ChatToolCall> ToolCalls { get; }
protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file needs to be regenerated before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants