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

Support Dify Provider #4084

Open
mumei-xxxx opened this issue Dec 13, 2024 · 0 comments
Open

Support Dify Provider #4084

mumei-xxxx opened this issue Dec 13, 2024 · 0 comments
Labels
ai/provider enhancement New feature or request

Comments

@mumei-xxxx
Copy link

mumei-xxxx commented Dec 13, 2024

Feature Description

The example can be found in the OpenAI Provider:

https://sdk.vercel.ai/providers/ai-sdk-providers/openai

It would be great if you could add a provider like Dify

https://docs.dify.ai/guides/application-publishing/based-on-frontend-templates

to make it usable with Vercel AI SDK.

Use Cases

import { createDify } from "@ai-sdk/dify";
import { streamObject } from 'ai';
import { z } from 'zod';

const dify = createDify({
    response_mode: "streaming",
    inputs: {
        name: "John Doe",
    },
});

const { partialObjectStream } = streamObject({
  model: dify,
  schema: z.object({
    recipe: z.object({
      name: z.string(),
      ingredients: z.array(z.string()),
      steps: z.array(z.string()),
    }),
  }),
  prompt: 'Generate a lasagna recipe.',
});

for await (const partialObject of partialObjectStream) {
  console.clear();
  console.log(partialObject);
}

Additional context

No response

@mumei-xxxx mumei-xxxx added the enhancement New feature or request label Dec 13, 2024
@mumei-xxxx mumei-xxxx changed the title Dify Provider Support Dify Provider Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/provider enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants