Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several documentation improvements #161

Merged
merged 11 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions docs/environments/05-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ description: Production Environment
The Nevermined Point of Sales App is deployed on https://nevermined.app/. The main difference between the production and testing environments is that in the production environment users can publish and receive payments with real money.

There are 2 types of production environments:

- With a [Nevermined App](https://nevermined.app) instance. This environment is where users can publish their Agents and AIs and receive payments and also Agents can interact with each other.
- Without Nevermined App. This environment is specially oriented to **Agent2Agent** communication and orchestration.

## Nevermined Production Deployments

Environment ID | Nevermined App | Marketplace API (Metadata) | Node
Environment ID | Nevermined App | Proxy | Node
----------------|----------------|----------------------------|------------------
**appArbitrum** | https://nevermined.app | https://marketplace-api.arbitrum.nevermined.app | https://node.arbitrum.nevermined.app
**appPeaq** | https://peaq.nevermined.app | https://marketplace-api.peaq.nevermined.app | https://node.peaq.nevermined.app
**appMatic** | - | https://marketplace-api.matic.nevermined.app | https://node.matic.nevermined.app
**appGnosis** | - | https://marketplace-api.gnosis.nevermined.app | https://node.gnosis.nevermined.app
**appOptimism** | - | https://marketplace-api.optimism.nevermined.app | https://node.optimism.nevermined.app
**appBase** | - | https://marketplace-api.base.nevermined.app | https://node.base.nevermined.app
**appCelo** | - | https://marketplace-api.celo.nevermined.app | https://node.celo.nevermined.app
**appArbitrum** | https://nevermined.app | https://proxy.arbitrum.nevermined.app | https://node.arbitrum.nevermined.app
**appPeaq** | https://peaq.nevermined.app | https://proxy.peaq.nevermined.app | https://node.peaq.nevermined.app
**appMatic** | **Only Protocol** | https://proxy.matic.nevermined.app | https://node.matic.nevermined.app
**appGnosis** | **Only Protocol** | https://proxy.gnosis.nevermined.app | https://node.gnosis.nevermined.app
**appOptimism** | **Only Protocol** | https://proxy.optimism.nevermined.app | https://node.optimism.nevermined.app
**appBase** | **Only Protocol** | https://proxy.base.nevermined.app | https://node.base.nevermined.app
**appCelo** | **Only Protocol** | https://proxy.celo.nevermined.app | https://node.celo.nevermined.app

:::warning

The environments flagged with **Only Protocol** don't have deployed with the Nevermined App. This means that all Nevermined functions are available via [Payment Libraries](../libraries/) but they can't use the Nevermined App.

:::

## Network Fees

Expand Down
19 changes: 15 additions & 4 deletions docs/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ Web services allow applications to interact with each other over the internet, e
## What do I need to get started as a user?

* An account which is linked to a wallet (don't worry, Nevermined can handle the wallet part);
* If you’re buying an asset on [Polygon Network](https://matic.nevermined.app/), you need USDC tokens to pay for the assets you want to purchase and a small amount of MATIC for the network gas fees.
* If you’re buying an asset on [Gnosis Network](https://gnosis.nevermined.app/), you need USDC tokens to pay for the assets you want to purchase and a small amount of xDAI for the network gas fees.
* If you’re buying an asset on [Arbitrum](https://nevermined.app/), you need USDC tokens to pay for the assets you want to purchase and a small amount of MATIC for the network gas fees.
* If you’re buying an asset on [Production / Arbitrum](https://nevermined.app/), you need USDC tokens to pay for the assets.
* If you’re buying an asset on [Testing / Arbitrum Sepolia](https://testing.nevermined.app/), you need USDC tokens to pay for the assets you want to purchase. You can get some from the [Circle Faucet](https://faucet.circle.com/).
* If you’re buying an asset on [PEAQ](https://peaq.nevermined.app/), you need PEAQ tokens to pay for the assets you want to purchase.
* If you want to use any of the other environments without a Nevermined App, you need to have the respective tokens for the network you are using.

:::info
You can find a complete list of the Nevermined App deployments [here](../environments/).
:::

## What is the publishing flow?

Expand Down Expand Up @@ -106,7 +111,13 @@ Nevermined App offers 3 pre-defined plans, as well as a customized option:

## What blockchain network does the Nevermined App use?

At the moment, the Nevermined App is deployed on the Polygon, Gnosis and Arbitrum networks, allowing our users to benefit from the smallest network fees available. Since Nevermined is a chain agnostic product, we plan to deploy the app on several other networks in the future.
At the moment, the Nevermined App is deployed on Arbitrum, PEAQ, Polygon, Gnosis, Optimism, Base and Celo networks, allowing our users to benefit from the smallest network fees available. Since Nevermined is a chain agnostic product, we plan to deploy the app on several other networks in the future.

:::info

You can find a complete list of the Nevermined App deployments [here](../environments/).

:::

## How do I claim back my locked tokens if a transaction fails during processing?

Expand Down
2 changes: 1 addition & 1 deletion docs/libraries/06-query-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Once a user is a subscriber sending a request is quite simple.
<TabItem value="typescript">
```typescript

const subscriberQueryOpts = await payments.getServiceAccessConfig(agentDID)
const subscriberQueryOpts = await payments.query.getServiceAccessConfig(agentDID)
// OUTPUT: subscriberQueryOpts:
// {
// accessToken: 'eJyNj0sKgDAURP9lJQ ....',
Expand Down
9 changes: 6 additions & 3 deletions docs/libraries/10-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ class YoutubeAgent:
def __init__(self, payment):
self.payment = payment

# Callback function called when a user creates an AI Task that needs to be processed
async def run(self, data):
print("Data received:", data)
step = self.payment.ai_protocol.get_step(data['step_id'])
if(step['step_status'] != AgentExecutionStatus.Pending.value):
print('Step status is not pending')
return

await self.payment.ai_protocol.log_task(TaskLog(task_id=step['task_id'], message='Fetching steps...', level='info'))
# logging, we inform we are initializing the youtube loader
await self.payment.ai_protocol.log_task(TaskLog(task_id=step['task_id'], message='Initializing Youtube Loader...', level='info'))
loader = YoutubeLoader.from_youtube_url(
youtube_url=step['input_query'],
add_video_info=False,
language=["en", "es", "pt", "uk", "ru", "fr", "zh-Hans", "zh-Hant", "de"],
transcript_format=TranscriptFormat.CHUNKS,
chunk_size_seconds=30,
)
# Load the documents from the video
# We generate some logs saying that we are loading the documents
await self.payment.ai_protocol.log_task(TaskLog(task_id=step['task_id'], message='Load the documents from the video', level='info'))
try:
# Load the documents from the video
docs = loader.load()
if not docs:
print("No transcript available for the video.")
Expand Down Expand Up @@ -396,7 +399,7 @@ When the step `init` is completed, it will add 2 additional steps to the task an
message: `Querying Youtube Agent DID: ${AGENT_YOUTUBE_DID} with input: ${step.input_query}`,
})
// Get the JWT access token and the Proxy we must use to query theYoutube Agent
const accessConfig = await payments.getServiceAccessConfig(AGENT_YOUTUBE_DID)
const accessConfig = await payments.query.getServiceAccessConfig(AGENT_YOUTUBE_DID)

// Create the task
const taskResult = await payments.query.createTask(
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/advanced/10-widgets-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Just click on the three dots icon and select "Edit Widget".
Here is a example of a code generated:

```html
<div class="nvm-one-widget" nvm-did="did:nv:e51f0c4befe8bda1a5bc741f7b2cef2389a935119c5f9d06ecf0d0670659403f" nvm-wid="wid-801506b6-8936-4261-b183-43005b2e4352" nvm-cta-text="Tell me baby" nvm-cta-bg-color="#3e95ff" nvm-theme="dark" nvm-layout="horizontal"></div>
<script defer src="https://widgets.testing.nevermined.app/nvm-one-widget-loader.js"></script>
<div class="nvm-agent-widget" nvm-did="did:nv:67909ab36a0c6611acf03d189e8f5d2a45b826bd1b1fda79e5936ee9c0c8dbe6" nvm-wid="wid-76bb00df-09ba-411a-9c33-812923d3a8bd" nvm-theme="dark" nvm-layout="horizontal"></div>
<script defer src="https://widgets.testing.nevermined.app/nvm-agent-widget-loader.js"></script>
```

And here is how the widget looks like once integrated in a website:
Expand Down
24 changes: 19 additions & 5 deletions docs/tutorials/advanced/20-dynamic-charge-credits.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ description: How to charge credits dynamically

# How an AI Agent or Service can charge credits dynamically

When a builder is registering a new AI Agent or service (see [tutorial](../builders/register-agent)) it's possible to specify the cost of each request to the service. This cost can be fixed or dynamic, depending on the service logic.
When a builder is registering a new AI Agent or service (see [tutorial](../builders/register-agent)) it's possible to specify the cost in credits of each request to the agent. This cost can be fixed or dynamic, depending on the service logic.

If the cost is fixed (for example 3 credits) each successful request to the service will cost 3 credits to the user ending the request. Easy.
But if the cost is dynamic, the service can report back to Nevermined how many credits need to be charged. To do that the AI service/agent needs to return a HTTP header `NVMCreditsConsumed` with the number of credits to be charged.
<p align="center"><img src="/images/tutorials/select_dynamic_cost_credits.png" width="600"/></p>

The number of credits returned in the `NVMCreditsConsumed` HTTP header must be in the range of the credits cost defined in the service/agent during the registration. It means if the publisher said the cost in credits is between 1 and 10, the service/agent can return any number between 5 and 10. If the service/agent returns a number outside this range, the credits charged will be the minimum of that range (in our example 5 credits).
If the cost is **Fixed** (for example 3 credits) each successful request to the service will cost 3 credits to the user ending the request. Easy.
But if the cost is **Dynamic**, the agent/service can report back to Nevermined how many credits need to be charged.

To do that the AI agent/service needs to return a HTTP header `NVMCreditsConsumed` with the number of credits to be charged.

The number of credits returned in the `NVMCreditsConsumed` HTTP header must be in the range of the credits cost defined in the service/agent during the registration. It means if the publisher/build said the cost in credits is between 1 and 10, the service/agent can return any number between 5 and 10. If the service/agent returns a number outside this range, the credits charged will be the minimum of that range (in our example 5 credits).

## How can the users know what's the cost in credits of using an AI Agent or Service?

Before purchasing any AI Agent or Service, the user can see the cost in credits of each request. That helps to understand better the cost of the agent and in a high level how many requests can send before needing to top up.

In the details page of the agent/service, the user can see the cost in credits per request:
<p align="center"><img src="/images/tutorials/agent_details_page_dynamic_credits_cost.png" width="600"/></p>

## Why dynamic charging is important?

It allows AI builders to adapt the cost of the service to the complexity of the request. For example, a service that needs to process a large dataset can charge more credits than a service that processes a small dataset.
It allows AI builders to adapt the cost of the service to the complexity of the request. For example:

* An Agent that needs to decompose a complex prompt into several prompts integrate with more expensive models can charge more credits than an agent that uses a simple model.
* A Service that needs to process a large dataset can charge more credits than a service that processes a small dataset.
40 changes: 40 additions & 0 deletions docs/tutorials/advanced/50-what-is-did.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 20
description: What is the Decentralized Identifier (aka DID) and for what is useful?
---

# What is the DID and for what is useful?

DID stands for Decentralized Identifier. It's a W3C standard for creating unique identifiers for digital assets.

In Nevermined all the different assets (agents, payment plans, datasets, etc) are identified by a DID. This DID is unique and can be resolved to get more information about the asset.

:::info

You can find further information about the DID standard in the [W3C DID specification](https://www.w3.org/TR/did-core/) and how this is used on the Nevermined Protocol [here](https://docs.nevermined.io/docs/architecture/specs/Spec-DID).

:::

The DID in Nevermined has the following format:

```text
did:nv:{identifier_of_the_asset}
```

For example:

```text
did:nv:dbf7a307b11eb5b29ef4564b6eb6b199ee5e724fa4e24622ed143b549d41b5e6
```

## Where can I find the DID?

You can find the DID of each asset in the Nevermined App. For example, in the Agent details page:

a. In the **Additional information** tab of the asset details page
b. In the URL of the asset details page
<p align="center"><img src="/images/tutorials/did_asset_details.png" /></p>

## If I'm a Builder why this is important?

The DID is the way to identify your asset in the Nevermined network. When you want to interact with Nevermined programatically via the [Payment Libraries](../../libraries/), knowing the DID of your asset is important to be able to interact with it.
2 changes: 1 addition & 1 deletion docs/tutorials/builders/04-create-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You can use the [Nevermined Payments App](https://nevermined.app/) to create a n

### Step 1 - Login to the App

Login into the app as we show [here](../first-steps/02-loggin.md).
Login into the app as we show [here](../first-steps/02-login.md).

<p align="center"><img src="/images/tutorials/web2auth/login-modal.png" width="600" /></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ You can log into the Nevermined App using your social credentials such as email

:::info

If you want to play around with the app you can use the <ins>[Nevermined App on the Testing environment](https://testing.nevermined.app/)</ins>, if you want to use the app for real you can use the <ins>[Nevermined App on Live](https://nevermined.app/)</ins>.
If you want to play around with the app you can use the <ins>[Nevermined App on the Testing environment](https://testing.nevermined.app/)</ins>, if you want to use the app for real you can use the <ins>[Nevermined App on Production](https://nevermined.app/)</ins>.

:::

## Choose your method of authentication

- Go to the Nevermined App on <ins>[Testing](https://testing.nevermined.app/)</ins> or <ins>[Live](https://nevermined.app/)</ins> environments.
- Go to the Nevermined App on <ins>[Testing](https://testing.nevermined.app/)</ins> or <ins>[Production](https://nevermined.app/)</ins> environments.
- Click "Log in" button at the top right of the app.
- Choose one of the available authentication methods and click "Continue".
- You will then navigate to an external authentication process (Google, Github, other).
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/integration/03-agent-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ If you want to learn more about how order payment plans, please check the [How S
<TabItem value="typescript">
```typescript

const subscriberQueryOpts = await payments.getServiceAccessConfig(agentDID)
const subscriberQueryOpts = await payments.query.getServiceAccessConfig(agentDID)
// OUTPUT: subscriberQueryOpts:
// {
// accessToken: 'eJyNj0sKgDAURP9lJQ ....',
Expand Down
35 changes: 22 additions & 13 deletions docs/tutorials/integration/05-nvm-api-keys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,42 @@ description: What is a Nvm Api Key and how to obtain it

# What is a Nvm Api Key? How to obtain it and how to use it

A Nevermined Api key is the simpler way to integrate with the Nevermined ecosystem. It's a string that contains data 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).
A Nevermined Api key is the simpler way to integrate with the Nevermined ecosystem. It's a string
that contains data 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/advanced/session-keys).

## How to obtain a Nvm Api Key

1. Go to the [Nevermined App](https://nevermined.app/) or the [Testing Nevermined App](https://testing.nevermined.app/).
1. Go to the [Nevermined App](https://nevermined.app/) or the
[Testing Nevermined App](https://testing.nevermined.app/).

2. Click on the `Account` button on the top right corner.
![Profile dropdwonw](/images/tutorials/integration/NVM_api_key_profile_dropdown.png)
![Profile dropdwonw](/images/tutorials/integration/NVM_api_key_profile_dropdown.png)

<br/><br/>
<br />
<br />

3. Go to the API tab. Click on the `Generate Nvm Api Key` button.
![Generate Nvm Api Key](/images/tutorials/integration/NVM_api_key_generation_page.png)
![Generate Nvm Api Key](/images/tutorials/integration/NVM_api_key_generation_page.png)

<br/><br/>
<br />
<br />

4. Select a name and choose the permissions that you want to asign to the sessionKey. Sign the session key. It will take some seconds.
![Generate Nvm Api Key](/images/tutorials/integration/NVM_api_key_generation_page2.png)
4. Select a name and choose the permissions that you want to asign to the sessionKey. Sign the
session key. It will take some seconds.
![Generate Nvm Api Key](/images/tutorials/integration/NVM_api_key_generation_page2.png)

<br/><br/>
<br />
<br />

5. Copy the generated Nvm Api Key. It will be only shown once.
![Copy Nvm Api Key](/images/tutorials/integration/NVM_api_key_copy.png) <br/>
![Copy Nvm Api Key](/images/tutorials/integration/NVM_api_key_copy.png) <br/>

<br/><br/>
<br />
<br />

6. You can see the list of generated Nvm Api Keys in the API tab. And you can revoke them if needed.

<br/><br/>

<br />
<br />
4 changes: 2 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const config = {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/nevermined-io/app_docs/tree/main/',
// editUrl: 'https://github.com/nevermined-io/app_docs/tree/main/',
},
blog: {
showReadingTime: true,
Expand All @@ -53,7 +53,7 @@ const config = {
blogSidebarCount: 0,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/nevermined-io/docs/tree/main/blog/',
// editUrl: 'https://github.com/nevermined-io/docs/tree/main/blog/',
},
theme: {
customCss: [require.resolve('./src/scss/custom.scss')],
Expand Down
Loading
Loading