Mem0.NetCore 1.1.0

dotnet add package Mem0.NetCore --version 1.1.0
                    
NuGet\Install-Package Mem0.NetCore -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mem0.NetCore" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mem0.NetCore" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Mem0.NetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mem0.NetCore --version 1.1.0
                    
#r "nuget: Mem0.NetCore, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mem0.NetCore@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mem0.NetCore&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Mem0.NetCore&version=1.1.0
                    
Install as a Cake Tool

Mem0.NetCore

English | 中文

A .NET wrapper SDK for Mem0Client that facilitates integration and API calls to the Mem0 intelligent memory service in .NET projects.

Features

  • Supports .NET 6.0, 7.0, 8.0, 9.0
  • Encapsulates common Mem0 API interfaces (CRUD operations)
  • Supports asynchronous calls
  • Simple and easy to integrate

Installation

Install via NuGet (after release):

dotnet add package Mem0.NetCore

Quick Start

1. Dependency Injection Registration

Register Mem0Client service in Program.cs:

using Mem0.NetCore;

var builder = WebApplication.CreateBuilder(args);

// Register Mem0Client service
builder.Services.AddMem0Client();

var app = builder.Build();
// ... other configurations

2. Configuration File Setup

Add Mem0 configuration in appsettings.json:

{
  "Mem0": {
    "ApiKey": "your-mem0-api-key",
    "Endpoint": "https://api.mem0.ai",
    "OrganizationId": "your-org-id",
    "ProjectId": "your-project-id"
  }
}

3. Usage Example

using Mem0.NetCore;
using Mem0.NetCore.Models;

// Get client through dependency injection
public class MyService
{
    private readonly IMem0Client _mem0Client;

    public MyService(IMem0Client mem0Client)
    {
        _mem0Client = mem0Client;
    }

    public async Task UseMem0Client()
    {
        // Add memories
        var addRequest = new AddMemoriesRequest
        {
            // Fill in request parameters
        };
        var addResponse = await _mem0Client.AddMemoriesAsync(addRequest);

        // Search memories
        var searchResults = await _mem0Client.SearchAsync("example", limit: 10);

        // Get memory details
        var memory = await _mem0Client.GetMemoryAsync("memoryId");

        // Delete memory
        var success = await _mem0Client.DeleteMemoryAsync("memoryId");
    }
}

If you don't want to use dependency injection, you can also instantiate directly:

using Mem0.NetCore;
using Mem0.NetCore.Models;

// Initialize client
var client = new Mem0Client("your-mem0-api-key");

// Add memories
var addRequest = new AddMemoriesRequest
{
    // Fill in request parameters
};
var addResponse = await client.AddMemoriesAsync(addRequest);

// Search memories
var searchRequest = new SearchRequest
{
    Query = "example",
    Limit = 10
};
var searchResults = await client.SearchAsync(searchRequest);

// Get memory details
var memory = await client.GetMemoryAsync("memoryId");

// Delete memory
var success = await client.DeleteMemoryAsync("memoryId");

API Reference

  • AddMemoriesAsync(AddMemoriesRequest request): Add memories
  • SearchAsync(SearchRequest request): Search memories
  • GetMemoryAsync(string memoryId): Get memory details
  • DeleteMemoryAsync(string memoryId): Delete memory
  • ... (For more APIs, please refer to source code and comments)

Configuration

  • API Key: Please obtain your API Key from the Mem0 official website.
  • BaseUrl: If you need to customize the service address, you can pass it during initialization.

Contributing

Welcome to submit Issues or Pull Requests to contribute!

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 142 7/17/2025
1.0.0 139 7/14/2025

发布封装mem0的C#操作方法