generative-ai-docs
Documentation for Google's Gen AI site - including the Gemini API and Gemma
Top Related Projects
Examples and guides for using the OpenAI API
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
An Open Source Machine Learning Framework for Everyone
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Quick Overview
The google/generative-ai-docs repository is a comprehensive documentation resource for Google's Generative AI technologies. It provides detailed guides, tutorials, and reference materials for developers working with Google's AI tools and APIs, focusing on large language models and generative AI applications.
Pros
- Extensive and well-organized documentation covering various aspects of generative AI
- Regular updates to keep pace with rapidly evolving AI technologies
- Includes code samples and practical examples for easier implementation
- Offers guidance on best practices and ethical considerations in AI development
Cons
- Primarily focused on Google's AI offerings, potentially limiting coverage of other AI platforms
- May require frequent updates to stay current with rapidly changing AI landscape
- Some advanced topics might be challenging for beginners in AI development
- Documentation density could be overwhelming for newcomers to the field
Getting Started
To get started with Google's Generative AI documentation:
- Visit the repository at https://github.com/google/generative-ai-docs
- Browse the
site
directory for specific topics of interest - Refer to the
README.md
file for an overview and navigation guide - Check out the
examples
folder for practical code samples and use cases
Note: This repository is primarily a documentation resource and does not contain a code library for direct implementation. Instead, it provides guidance on using Google's AI tools and APIs in your projects.
Competitor Comparisons
Examples and guides for using the OpenAI API
Pros of openai-cookbook
- More comprehensive, with a wider range of examples and use cases
- Includes advanced topics like fine-tuning and embeddings
- Regularly updated with new features and best practices
Cons of openai-cookbook
- Focuses solely on OpenAI's models, limiting its applicability
- May be overwhelming for beginners due to its extensive content
- Lacks integration examples with other AI services or platforms
Code Comparison
generative-ai-docs:
from vertexai.preview.language_models import TextGenerationModel
model = TextGenerationModel.from_pretrained("text-bison@001")
response = model.predict("Tell me a joke about AI", max_output_tokens=256)
print(response.text)
openai-cookbook:
import openai
response = openai.Completion.create(
engine="text-davinci-002",
prompt="Tell me a joke about AI",
max_tokens=256
)
print(response.choices[0].text.strip())
Both examples demonstrate basic text generation, but generative-ai-docs uses Google's Vertex AI, while openai-cookbook uses OpenAI's API. The OpenAI example is slightly more concise, but both achieve similar results with different platforms.
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
Pros of transformers
- Extensive library of pre-trained models for various NLP tasks
- Active community with frequent updates and contributions
- Comprehensive documentation and examples for easy implementation
Cons of transformers
- Steeper learning curve for beginners due to its extensive features
- Larger library size, which may impact project load times
- May require more computational resources for some models
Code Comparison
transformers:
from transformers import pipeline
classifier = pipeline("sentiment-analysis")
result = classifier("I love this product!")[0]
print(f"Label: {result['label']}, Score: {result['score']:.4f}")
generative-ai-docs:
import google.generativeai as palm
palm.configure(api_key=YOUR_API_KEY)
response = palm.generate_text(prompt="Translate 'Hello' to French")
print(response.result)
The transformers library offers a more comprehensive set of tools for various NLP tasks, while generative-ai-docs focuses on Google's PaLM API for text generation. transformers provides pre-trained models and pipelines for quick implementation, whereas generative-ai-docs requires API configuration and offers a simpler interface for text generation tasks.
ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Pros of onnxruntime
- Provides a comprehensive runtime for machine learning models
- Supports multiple programming languages and platforms
- Offers performance optimizations for various hardware
Cons of onnxruntime
- More complex setup and usage compared to documentation-focused repos
- Requires deeper technical knowledge to utilize effectively
- May have a steeper learning curve for beginners
Code Comparison
onnxruntime (Python):
import onnxruntime as ort
session = ort.InferenceSession("model.onnx")
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
result = session.run([output_name], {input_name: input_data})
generative-ai-docs (JavaScript):
const genAI = new GoogleGenerativeAI(API_KEY);
const model = genAI.getGenerativeModel({ model: "gemini-pro" });
const result = await model.generateContent("Your prompt here");
console.log(result.response.text());
While onnxruntime focuses on providing a runtime for executing machine learning models across various platforms, generative-ai-docs is primarily a documentation repository for Google's Generative AI services. onnxruntime offers more flexibility and performance optimizations, but requires more technical expertise. generative-ai-docs provides simpler integration with Google's AI services but is limited to their specific offerings.
An Open Source Machine Learning Framework for Everyone
Pros of TensorFlow
- Extensive ecosystem with tools, libraries, and community support
- Highly scalable for large-scale machine learning projects
- Supports multiple programming languages and platforms
Cons of TensorFlow
- Steeper learning curve for beginners
- Can be more complex to set up and configure
- Larger footprint and potentially slower for small projects
Code Comparison
generative-ai-docs:
from vertexai.language_models import TextGenerationModel
model = TextGenerationModel.from_pretrained("text-bison@001")
response = model.predict("Tell me a joke about AI")
print(response.text)
TensorFlow:
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='categorical_crossentropy')
The generative-ai-docs repository focuses on documentation and examples for Google's Generative AI, while TensorFlow is a comprehensive machine learning framework. generative-ai-docs provides simpler, high-level APIs for specific AI tasks, whereas TensorFlow offers more flexibility and control over model architecture and training processes.
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Pros of PyTorch
- Extensive deep learning framework with a wide range of tools and libraries
- Large, active community contributing to development and support
- Flexible and dynamic computational graph for easier debugging
Cons of PyTorch
- Steeper learning curve for beginners compared to generative-ai-docs
- Larger codebase and more complex installation process
- Less focused on specific generative AI applications
Code Comparison
generative-ai-docs:
import google.generativeai as genai
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content("Hello, how are you?")
print(response.text)
PyTorch:
import torch
import torch.nn as nn
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(10, 1)
def forward(self, x):
return self.linear(x)
model = SimpleModel()
Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Pros of fairseq
- More comprehensive and feature-rich, offering a wide range of sequence modeling tools
- Longer development history and larger community, resulting in more contributions and extensions
- Supports a broader range of tasks, including machine translation, language modeling, and speech recognition
Cons of fairseq
- Steeper learning curve due to its extensive features and options
- May be overkill for simple projects or those focused solely on generative AI
- Requires more setup and configuration compared to the streamlined generative-ai-docs
Code Comparison
fairseq:
from fairseq.models.transformer import TransformerModel
en2de = TransformerModel.from_pretrained('/path/to/model', checkpoint_file='model.pt')
en2de.translate('Hello world!')
generative-ai-docs:
import google.generativeai as palm
palm.configure(api_key=YOUR_API_KEY)
response = palm.generate_text(prompt="Translate 'Hello world!' to German")
print(response.result)
Summary
fairseq is a more comprehensive toolkit for sequence modeling tasks, offering a wide range of features and flexibility. It's ideal for advanced users and complex projects. generative-ai-docs, on the other hand, provides a more focused and user-friendly approach to generative AI, making it easier for beginners to get started with specific generative tasks.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Google Gemini API Website & Documentation
These are the source files for the guide and tutorials on the Generative AI developer site, home to the Gemini API and Gemma.
Path | Description |
---|---|
site/ | Notebooks and other content used directly on ai.google.dev. |
demos/ | Demos apps. Larger than examples, typically consists of working apps. |
examples/ | Examples. Smaller, single-purpose code for demonstrating specific concepts. |
To contribute to the site documentation, please read CONTRIBUTING.md.
To contribute as a demo app maintainer, please read DEMO_MAINTAINERS.md.
To file an issue, please use the GitHub issue tracker.
License
Top Related Projects
Examples and guides for using the OpenAI API
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
An Open Source Machine Learning Framework for Everyone
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot