thatbeautifuldream / developer-documentation

Documentation for Developers
https://100xdocs.com
MIT License
64 stars 15 forks source link

[FEAT]: Add calls to GAI preferably [Gemini] for docs-bot #6

Open thatbeautifuldream opened 10 months ago

thatbeautifuldream commented 10 months ago

Description

The APIs are now generally available and have a generous free tier with upto 60 request per minute.

Quickstart to consuming the library

const { GoogleGenerativeAI } = require("@google/generative-ai");

// Access your API key as an environment variable (see "Set up your API key" above)
const genAI = new GoogleGenerativeAI(process.env.API_KEY);

async function run() {
  // For text-only input, use the gemini-pro model
  const model = genAI.getGenerativeModel({ model: "gemini-pro"});

  const prompt = "Write a story about a magic backpack."

  const result = await model.generateContent(prompt);
  const response = await result.response;
  const text = response.text();
  console.log(text);
}

run();

https://ai.google.dev/tutorials/node_quickstart

Additional Information

No response

thatbeautifuldream commented 10 months ago

https://github.com/thatbeautifuldream/100xdocs/blob/main/pages/api/bot.ts#L15

thatbeautifuldream commented 10 months ago

[TODO] : add auth setup to whole app and rate limits for future.

thatbeautifuldream commented 10 months ago

Decided to offload the chat to vercel ai chat.

Fetch content from the app but a route parsing and cleaning MDX to a string for prompt feed.