Skip to content

Commit

Permalink
feat: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Oct 21, 2024
1 parent 50e5136 commit ecaba18
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 8
sidebar_position: 15
description: Nevermined AI Hub
---

Expand All @@ -22,11 +22,15 @@ The AI Hub provides:
* Automatic accounting for the usage of the Agent. Subscribers sending Tasks to the Agent will be charged in credits for their Tasks. When they use all the credits they have available the access will be restricted, so if they want to continue using the Agent they must topup.
* Orchestration of tasks. The backend allow AI builders to define their workflow of Steps and receive the Steps to process in the right order. When all the Steps resolving a Task are **Completed**, the backend will complete the whole Task successfully. If any of the Steps fails, the backend will complete the whole Task as **Failed**.

:::tip
The AI Hub is under active development, so new exciting features will be available soon
:::

## How an AI Builder can use the AI Hub?

It's very simple. An AI Builder just needs to:

1. Get their own [Nevermined API Key](../tutorials/integration/nvm-api-keys)
2. Install the [Payments library](../libraries/) in their project
3. Integrate with the AI Hub to start [processing AI Tasks](../libraries/process-tasks)

4. [Register the new AI Agent](../tutorials/builders/register-agent) into a Nevermined deployment
5 changes: 3 additions & 2 deletions docs/libraries/02-getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ You need to keep your API Key secure and never share it with anyone.
</TabItem>
<TabItem value="typescript">
```typescript
// @see https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys
// To get your own Nevermined API Key, follow the instructions here:
// https://docs.nevermined.app/docs/tutorials/integration/nvm-api-keys
const nvmApiKey = 'eyJhbGciOiJFUzI1NksifQ.ey .....'

// If you want to connect to production use 'arbitrum' as environment
Expand All @@ -81,7 +82,7 @@ You need to keep your API Key secure and never share it with anyone.
```typescript
// If you want to connect to production use 'arbitrum' as environment
const payments = Payments.getBrowserInstance({
returnUrl: 'https://mysite.example',
returnUrl: 'https://mysite.example.com',
environment: 'testing'
})
payments.connect()
Expand Down
15 changes: 15 additions & 0 deletions docs/libraries/10-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ description: Examples
# Examples

The Payment Libraries allow you to interact with the Nevermined platform to create and manage Payment Plans and AI Agents.

## AI Agents

### Youtube Agent (Python)

The Youtube Summarizer it's a small Python AI Agent with Nevermined Payments Library integrated which receives a Youtube video URL and returns a summary of the transcription of the video.

The Agent uses LangChain to retrieve the transcription and summarize it via OpenAI integration.

Here is the [Youtube Summarizer Agent code](https://github.com/nevermined-io/youtube-agent/).

## Notebooks

In the [Python Notebook](https://colab.research.google.com/drive/1Pqrfm3P5t8P9DS7Hwp3v72jhRrB2KsP5#scrollTo=dghI-HwVgulp) example, we will show you how to use the Payments Library to create Payment Plans, register AI Agents, and query them.

6 changes: 5 additions & 1 deletion docs/tutorials/integration/nextjs-react-payments.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
sidebar_position: 5
sidebar_position: 8
description: How to integrate the Nevermined Payments library in a react application
---

import PaymentsTutorial from '@site/src/components/payments/tutorial'

# Tutorial on how to use the Nevermined Payments Protocol in a React app

:::tip
To have full details about how to use the [Payments Library](../../libraries/), please visit the [documentation section](../../libraries/)
:::

### Initializing the project

For this tutorial we will be using [nextjs](https://nextjs.org/docs/getting-started/installation)
Expand Down
13 changes: 10 additions & 3 deletions docs/tutorials/integration/python-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ description: How to integrate the Nevermined Payments Python library

The objective of this library is to make possible the integration of Nevermined payments in the Python code ecosystem. This library provides a set of functions to interact with the Nevermined network, including the ability to register subscriptions and subscribe to web services and get the JWT access token to call them.

:::info
In a previous tutorial we showed [what is a Nvm Api Key and how to obtain it](nvm-api-keys).
:::tip

To have full details about how to use the [Payments Library](../../libraries/), please visit the [documentation section](../../libraries/)

:::

Expand All @@ -23,13 +23,20 @@ pip install payments-py

### Initialize the payments library

:::info

In a previous tutorial we showed [what is a Nvm Api Key and how to obtain it](nvm-api-keys).

:::

To initialize the payments library, you need to provide the following parameters:

- Nvm Api key: It's a string that identifies the session key of the account abstraction and some extra data as the marketplace auth token. It works similar to a jwt but for blockchain accounts. You can find more in [zeroDev docs](https://docs.zerodev.app/sdk/plugins/session-keys).
- Environment: It's an enum that represents the environment where the library will interact with the Nevermined network. It can be `Environment.appTesting` or `Environment.appArbitrum`.
- App id: It's a string that represents the app id. Currently is optional.
- Version: It's a string that represents the version of the app. Currently is optional.


```
from nevermined_payments import Payments
Expand Down

0 comments on commit ecaba18

Please sign in to comment.