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

Extend ai/rsc render function to handle additional parameters #1061

Open
fozziethebeat opened this issue Mar 3, 2024 · 0 comments · May be fixed by #1087
Open

Extend ai/rsc render function to handle additional parameters #1061

fozziethebeat opened this issue Mar 3, 2024 · 0 comments · May be fixed by #1087
Labels
good first issue Good for newcomers

Comments

@fozziethebeat
Copy link

Feature Description

Right now the render method has the following function signature:

/**
   * The model name to use. Must be OpenAI SDK compatible. Tools and Functions are only supported
   * GPT models (3.5/4), OpenAI Assistants, Mistral small and large, and Fireworks firefunction-v1.
   *
   * @example "gpt-3.5-turbo"
   */
  model: string;
  /**
   * The provider instance to use. Currently the only provider available is OpenAI.
   * This needs to match the model name.
   */
  provider: OpenAI;
  messages: Parameters<
    typeof OpenAI.prototype.chat.completions.create
  >[0]['messages'];
  text?: Renderer<{ content: string; done: boolean }>;
  tools?: {
    [name in keyof TS]: {
      description?: string;
      parameters: TS[name];
      render: Renderer<z.infer<TS[name]>>;
    };
  };
  functions?: {
    [name in keyof FS]: {
      description?: string;
      parameters: FS[name];
      render: Renderer<z.infer<FS[name]>>;
    };
  };
  initial?: ReactNode;
  temperature?: number;

It would be really helpful (and useful) to support a wider range of parameters with an arbitrary dictionary (maybe named additionalParams). Namely, max_tokens is missing from this function signature and thus callers can't guide the length of outputs.

Use Case

This allows users to use not just OpenAI models but also a wider range of models hosted by open source inference infrastructure. As an example, SGLang and Lorax have mostly OpenAI compatible APIs but they don't fully support function calling. Instead they have output format specifications for controlled JSON results. Without arbitrary parameters passed through to the completion call, these other services can't be used fully.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants