upstash/context7
context7 is hosted online, so all tools can be tested directly either in theInspector tabor in theOnline Client.
Context7 MCP provides up-to-date, version-specific documentation and code examples directly into your prompt, enhancing the capabilities of LLMs by ensuring they use the latest information.
Try context7 with chat:
Has a README
Github repo has a README.md.
Has a License
Github repo has license info.
Server can be inspected
View server inspector
Server schema can be extracted
Can get at lease one tool info from the README or server.
Online hosted on MCPHub
Can be automatically deployed by MCPHub.
Has social accounts
Has X or Discord account.
Claimed by the author or certified by MCPHub
Connected with the author
AI Evaluation ReportTotal Score: 9/10
The agent demonstrates strong capabilities in resolving library IDs and fetching detailed documentation for various libraries and packages. It effectively retrieves relevant content, including code snippets and descriptions, for libraries such as TensorFlow, PyTorch, Pandas, and Scikit-learn. The responses are generally accurate, comprehensive, and align well with the agent's described functions. However, there was a notable issue with the NumPy task, where inaccuracies in function signatures and misleading statements about changes were present. This indicates a potential limitation in handling certain libraries or modules with precision. Overall, the agent performs well in most tasks, providing useful and clear information, but there is room for improvement in ensuring accuracy and consistency across all libraries.
Test case 1
Score: 10/10Perform the operation of resolving the library ID for 'TensorFlow' and then fetch the documentation focusing on the 'Keras API' topic, retrieving up to 10,000 tokens of content.The library ID for "TensorFlow" has been successfully resolved, and I have retrieved comprehensive documentation focusing on the "Keras API." Below are some key sections and code snippets from the documentation:
Key Sections and Code Snippets
- Keras Model Architectures
- Description: Keras offers multiple ways to define model architectures, including the Sequential API, the Functional API, and subclassing.
- Code:
# Sequential Model model = tf.keras.Sequential([ tf.keras.layers.Dense(64, activation='relu', input_shape=(784,)), tf.keras.layers.Dense(10, activation='softmax') ])
- Keras Functional API Model Construction
- Description: Illustrates building a fully-connected network using the Functional API.
- Code:
inputs = tf.keras.Input(shape=(32,)) x = layers.Dense(64, activation='relu')(inputs) predictions = layers.Dense(10, activation='softmax')(x) model = tf.keras.Model(inputs=inputs, outputs=predictions)
- Compile Keras Model
- Description: API documentation for compiling a Keras model.
- Code:
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
- Keras Callbacks
- Description: Callbacks can be used during training for tasks like early stopping and model checkpointing.
- Code:
callbacks = [ tf.keras.callbacks.EarlyStopping(monitor='val_loss', patience=3), tf.keras.callbacks.ModelCheckpoint('best_model.h5', save_best_only=True) ] model.fit(x_train, y_train, callbacks=callbacks)
- Evaluate Model with
Model.evaluate
- Code:
model.evaluate(eval_dataset, return_dict=True)
- Code:
- Train Model with
Model.fit
- Description: Demonstrates training a Keras model using the
fit
method. - Code:
model.fit(dataset)
- Description: Demonstrates training a Keras model using the
Additional Information
- Keras Integration with TensorFlow: Keras serves as a high-level API integrated into TensorFlow, facilitating easy model building and training.
- Deployment: Keras models can be exported for use in various environments, including browsers and mobile devices. For a complete exploration of the Keras API, you can refer to the full documentation, which includes more detailed examples and additional topics such as performance optimization, custom layers, and advanced model configurations.
- Keras Model Architectures
Test case 2
Score: 10/10Perform the operation of resolving the library ID for 'PyTorch' and then fetch the documentation focusing on the 'torch.nn' module, retrieving up to 10,000 tokens of content.The library ID for 'PyTorch' has been successfully resolved, and the documentation focusing on the
torch.nn
module has been retrieved. Highlights include:- BatchNorm Fusion Utilities
- Description: API documentation for utility functions in
torch.nn.utils
to fuse Convolutional or Linear Modules with BatchNorm modules, optimizing inference performance. - Code Snippet:
fuse_conv_bn_eval fuse_conv_bn_weights fuse_linear_bn_eval fuse_linear_bn_weights
- Description: API documentation for utility functions in
- nn.Linear Module API Documentation Style Example
- Description: This example demonstrates the required docstring format for
torch.nn
modules, detailing thenn.Linear
module's API and its mathematical transformation. - Code Snippet:
Applies a linear transformation to the incoming data. y = xA^T + b
- Description: This example demonstrates the required docstring format for
- Loss Functions
- Description: Comprehensive set of PyTorch's loss functions used for training neural networks.
- Code Snippet:
nn.L1Loss nn.MSELoss nn.CrossEntropyLoss
- Neural Network Submodules
- Description: Lists various submodules within the
torch.nn
package for different functionalities. - Code Snippet:
torch.nn.modules.activation torch.nn.modules.batchnorm torch.nn.modules.dropout
- Description: Lists various submodules within the
- RNN Utilities
- Description: API documentation for utility functions and classes in
torch.nn.utils.rnn
for handling variable-length sequences in RNNs. - Code Snippet:
nn.utils.rnn.PackedSequence nn.utils.rnn.pack_padded_sequence
- Description: API documentation for utility functions and classes in
- Parameter Initialization Utilities
- Description: Utility functions in
torch.nn.utils
for initializing Module parameters. - Code Snippet:
skip_init
- Description: Utility functions in
- DataParallel Layers
- Description: API documentation for PyTorch's data parallelism modules for distributing model training across multiple GPUs.
- Code Snippet:
nn.DataParallel nn.parallel.DistributedDataParallel
The documentation includes extensive details on various utilities, loss functions, and modules within the
torch.nn
package, allowing you to effectively utilize PyTorch for building and training neural networks.- BatchNorm Fusion Utilities
Test case 3
Score: 5/10Perform the operation of resolving the library ID for 'NumPy' and then fetch the documentation focusing on the 'numpy.linalg' module, retrieving up to 10,000 tokens of content.The library ID for 'NumPy' has been successfully resolved, and the documentation for the
numpy.linalg
module has been retrieved. Below is a summary of the relevant content and code snippets from the documentation:NumPy linalg Module Overview
The
numpy.linalg
module includes various functions for linear algebra, including matrix and vector operations. Here's a selection of notable functions and changes:- Matrix Norms:
Computes the matrix norm of a matrix (or a stack of matrices).
numpy.linalg.matrix_norm(x, ord=None, keepdims=False)
- Vector Norms:
Computes the vector norm of a vector (or batch of vectors).
numpy.linalg.vector_norm(x, ord=None, axis=None, keepdims=False)
- Dot Products:
Computes the dot product of two arrays.
numpy.vecdot(x1, x2, *, axis=None)
- Outer Products:
Computes the outer product of two vectors.
numpy.linalg.outer(x1, x2)
- Cross Products:
Computes the cross product of two (arrays of) 3-dimensional vectors.
numpy.linalg.cross(x1, x2, *, axis=-1)
Notable Changes and Features
-
Backward Compatibility: Some functions were relocated to
numpy.linalg
, and their behavior was updated to support stacking and batching, affecting how they operate on multiple dimensions. -
NamedTuples: Functions within
np.linalg
that previously returned standard tuples now return NamedTuples, improving code readability. -
Performance Improvements: Functions like
np.linalg.det
andnp.linalg.svd
have been optimized for better performance, particularly when dealing with large matrices. -
Function Enhancements: New arguments such as
hermitian
fornumpy.linalg.pinv
enable faster computations for Hermitian matrices.
Example Usage
Here’s an example of how to use some of the
numpy.linalg
functions:import numpy as np # Define a matrix matrix = np.array([[1, 2], [3, 4]]) # Calculate the determinant det = np.linalg.det(matrix) # Perform Singular Value Decomposition (SVD) u, s, vh = np.linalg.svd(matrix) print(f"Determinant: {det}") print(f"Singular values: {s}")
Further Reading
For more detailed documentation, you can visit the NumPy Documentation that covers all functionalities provided by the
numpy.linalg
module.- Matrix Norms:
Test case 4
Score: 9/10Perform the operation of resolving the library ID for 'pandas' and then fetch the documentation focusing on the 'DataFrame' class, retrieving up to 10,000 tokens of content.I successfully resolved the library ID for 'pandas' and retrieved documentation focusing on the 'DataFrame' class. Below are some excerpts from the documentation, including code snippets and descriptions related to the 'DataFrame' class in Pandas:
Key Concepts and Code Snippets
- DataFrame Arithmetic: DataFrame + DataFrame
- Description: Demonstrates arithmetic operations between two DataFrames. Pandas automatically aligns them on both column and index labels.
- Code:
df = pd.DataFrame(np.random.randn(10, 4), columns=["A", "B", "C", "D"]) df2 = pd.DataFrame(np.random.randn(7, 3), columns=["A", "B", "C"]) df + df2
- Create DataFrame from Series
- Description: Converts a Pandas Series into a DataFrame. The DataFrame will have the same index as the Series.
- Code:
ser = pd.Series(range(3), index=list("abc"), name="ser") pd.DataFrame(ser)
- DataFrame Combining, Comparing, Joining, and Merging
- Description: Methods for combining DataFrames, comparing elements, joining based on indices, and merging based on common columns.
- Code:
DataFrame.assign(**kwargs) DataFrame.compare(other) DataFrame.join(other) DataFrame.merge(right)
- Sample Pandas DataFrame Structure
- Description: A textual representation of a pandas DataFrame, illustrating its index and a single column of data.
- Code:
a 0 0 1 1 ...
- DataFrame Operations
- Description: Demonstrates common operations on DataFrame columns, including selection, addition, deletion, and assignment.
- Code:
df["new_col"] = value # Assign a scalar value del df["column_name"] # Delete column by name
- DataFrame Missing Data Handling
- Description: Methods for detecting, filling, and dropping missing (NaN) values in a DataFrame.
- Code:
df.dropna(axis=0) df.fillna(value=0)
Additional Features
- Statistical Functions: Methods for calculating various statistical measures, including mean, median, standard deviation, and more.
- Merging and Joining: Extensive capabilities for merging and joining DataFrames based on common columns.
This documentation provides a comprehensive overview of the functionality offered by the
DataFrame
class in Pandas, including numerous examples that can be readily utilized in data analysis tasks.
- DataFrame Arithmetic: DataFrame + DataFrame
Test case 5
Score: 10/10Perform the operation of resolving the library ID for 'scikit-learn' and then fetch the documentation focusing on the 'RandomForestClassifier' class, retrieving up to 10,000 tokens of content.The library ID for scikit-learn has been successfully resolved, and the documentation for the
RandomForestClassifier
class has been retrieved. Below are key details and code snippets from the documentation:Library Information
- Library Name: Scikit-learn
- Library ID:
/scikit-learn/scikit-learn
- Description: scikit-learn: machine learning in Python
- Code Snippets Available: 3040
- Trust Score: 8.5
Documentation for
RandomForestClassifier
Here are some notable code snippets and their descriptions:
- Initialize and Fit Scikit-learn RandomForestClassifier
from sklearn.ensemble import RandomForestClassifier X = [[0, 0], [1, 1]] Y = [0, 1] clf = RandomForestClassifier(n_estimators=10) clf = clf.fit(X, Y)
- Description: Demonstrates basic usage by importing the class, defining training data, and fitting the model.
- Incrementally Fit RandomForestClassifier with warm_start
from sklearn.datasets import make_classification from sklearn.ensemble import RandomForestClassifier X, y = make_classification(n_samples=100, random_state=1) clf = RandomForestClassifier(n_estimators=10) clf = clf.fit(X, y) # fit with 10 trees clf.set_params(n_estimators=20, warm_start=True) clf.fit(X, y) # fit additional 10 trees
- Description: Shows how to use
warm_start=True
to add more trees to an already fitted model.
- Description: Shows how to use
- Evaluate Random Forest Classifier Performance with Cross-Validation
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score clf = RandomForestClassifier(n_estimators=10) scores = cross_val_score(clf, X, y, cv=5) print(scores.mean())
- Description: Applies 5-fold cross-validation to assess the model's performance.
- RandomForestClassifier: Equivalence of Single vs. Iterative Training
clf = RandomForestClassifier(n_estimators=20) # set `n_estimators` to 10 + 10 clf.fit(X, y) # fit
- Description: Illustrates that training once with total estimators is equivalent to building iteratively.
- Fix: RandomForestClassifier Predict Method for Multioutput
ensemble.RandomForestClassifier: Fix class_weight='balanced_subsample' with >32 classes
- Description: Corrects a bug in the
predict
method for multiclass multioutput configurations. These snippets illustrate different functionalities and improvements related to theRandomForestClassifier
. If you would like more specific information or additional snippets, please let me know!
- Description: Corrects a bug in the