GraphQL-AI-Mashup is an application that integrates various types of AI interfaces, providing a unified access method through GraphQL, and supporting features such as data streaming (stream).
New feature: Search the web in real time, by DuckDuckGo search engine.
- Supports multiple AI services, such as OpenAI, Anthropic Claude, GeminiPro, etc.
- Uses GraphQL to provide a unified API access, with standardized calling parameters
- Supports data streaming (stream) functionality
- Uses DataLoader to optimize API requests, improving performance
- Can be deployed to Vercel with a single click
AI | Default Model | Documentation | Search web in real time |
---|---|---|---|
OpenAI | gpt-3.5-turbo | Openai Models | Not Yet |
Cloudflare Workers AI | @cf/meta/llama-3-8b-instruct | Workers AI Models | Not Yet |
Azure OpenAI | gpt-3.5-turbo | Azure Openai Models | Yes |
GeminiPro | gemini-1.0-pro-latest | GeminiPro Models | Not Yet |
Claude | claude-3-haiku-20240307 | Claude Models | Normal: Yes Stream: No |
Moonshot | moonshot-v1-8k | Moonshot Models | Normal: Yes Stream: No |
Groq | mixtral-8x7b-32768 | Groq Models | Not Yet |
lingyiwanwu | yi-34b-chat-0205 | LingYiWanWu Models | Not Yet |
Baidu Ernie | ernie-3.5-4k-0205 | Get API KEY & SECRET KEY Ernie Models |
Not Yet |
Ali Qwen | qwen-turbo | Get API KEY Subscribe to Services Qwen Models |
Yes |
Zhipu AI | glm-3-turbo | API & Token Zhipu Models |
Not Yet |
npm install
cp .env.example .env
Modify the API keys in the .env
file.
npm run start
This project can be deployed via docker, and it comes with its own Dockerfile.
cp .env.example .env
Modify the API keys in the .env
file.
docker build -t graphql-ai-mashup .
docker run -dp 4000:4000 graphql-ai-mashup
Due to Vercel's limitations on the edge runtime, please refer to the project AI-Mashup-Web for deployment.
This project can be deployed to Cloudflare worker also. Please follow the steps.
Install and configure wrangler
npm install -g wrangler
wrangler login
clone this repository
git clone git@github.com:VeryInt/GraphQL-AI-Mashup.git
Build and deploy your Cloudflare Worker
cd GraphQL-AI-Mashup
wrangler build
wrangler deploy
The following is an example of using GraphQL to access the GeminiPro interface:
query MyQuery($params: ChatArgs) {
chat(params: $params) {
GeminiPro{text}
}
}
{
"params": {
"messages": [{
"role": "user",
"content": "Please tell an 800-word fairy tale"
}]
}
}
query MyQuery($params: ChatArgs) {
chat(params: $params) {
GeminiProStream @stream
}
}