Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 3.53 KB

nomic.md

File metadata and controls

93 lines (67 loc) · 3.53 KB

Nomic

Portkey provides a robust and secure gateway to facilitate the integration of various Large Language Models (LLMs) into your applications, including Nomic.

Nomic has especially become popular due to it's superior embeddings and is now available through Portkey's AI gateway as well.

With Portkey, you can take advantage of features like fast AI gateway access, observability, prompt management, and more, all while ensuring the secure management of your LLM API keys through a virtual key system.

{% hint style="info" %} Provider Slug**: nomic** {% endhint %}

Portkey SDK Integration with Nomic

Portkey provides a consistent API to interact with embedding models from various providers. To integrate Nomic with Portkey:

1. Create a Virtual Key for Nomic in your Portkey account

You can head over to the virtual keys tab and create one for Nomic. This will be then used to make API requests to Nomic without needing the protected API key.

Create a virtual key for Nomic in Portkey

2. Install the Portkey SDK and Initialize with this Virtual Key

Add the Portkey SDK to your application to interact with Nomic's API through Portkey's gateway. Set up Portkey with your virtual key as part of the initialization configuration.

Set up Portkey with your virtual key as part of the initialization configuration. You can create a virtual key for Azure in the UI.

{% tabs %} {% tab title="NodeJS SDK" %}

import Portkey from 'portkey-ai'
 
const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
    virtualKey: "VIRTUAL_KEY" // Your Nomic Virtual Key
})

{% endtab %}

{% tab title="Python SDK" %}

from portkey_ai import Portkey

portkey = Portkey(
    api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
    virtual_key="VIRTUAL_KEY"   # Replace with your virtual key for Nomic
)

{% endtab %} {% endtabs %}

3. Invoke the Embeddings API with Nomic

Use the Portkey instance to send requests to your Nomic API. You can also override the virtual key directly in the API call if needed.

{% tabs %} {% tab title="NodeJS SDK" %}

const embeddings = await portkey.embeddings.create({
    input: "create vector representation on this sentence",
    model: "nomic-embed-text-v1.5",
});

console.log(embeddings);

{% endtab %}

{% tab title="Python SDK" %}

embeddings = portkey.embeddings.create(
    input='create vector representation on this sentence',
    model='nomic-embed-text-v1.5'
)
print(embeddings)

{% endtab %} {% endtabs %}

Next Steps

The complete list of features supported in the SDK are available on the link below.

{% content-ref url="../../api-reference/portkey-sdk-client.md" %} portkey-sdk-client.md {% endcontent-ref %}

You'll find more information in the relevant sections:

  1. API Reference for Embeddings
  2. Add metadata to your requests
  3. Add gateway configs to your Nomic requests
  4. Tracing Nomic requests