Nido Documents
Home
  • GET STARTED
    • Introduction
    • Platform
      • Client code
      • Endpoints
      • Pricing and rate limits
  • Privacy & Legal
    • Terms of Service
    • Terms of Use
    • Privacy Policy
    • Data Processing Agreement
Powered by GitBook
On this page
  • Installation​
  • Chat Completion​
  • Embeddings​
  • Third-Party Clients
  • Go​
  1. GET STARTED
  2. Platform

Client code

PreviousPlatformNextEndpoints

Last updated 1 year ago

We provide client codes in both Python and Javascript.

Installation

Follow installation instructions in the repository for our Python Client or Javascript Client.

Chat Completion

The chat completion API allows you to chat with a model fine-tuned to follow instructions.

  • python

  • javascript

  • curl

from nido.client import NidoClient
from nido.models.chat_completion import ChatMessage

api_key = os.environ["NIDO_API_KEY"]
model = "nido-tiny"

client = NidoClient(api_key=api_key)

messages = [
    ChatMessage(role="user", content="What is the best French cheese?")
]

# No streaming
chat_response = client.chat(
    model=model,
    messages=messages,
)

# With streaming
for chunk in client.chat_stream(model=model, messages=messages):
    print(chunk)

We allow users to provide a custom system prompt (see API reference). A convenient safe_mode flag allow to force chat completion to be moderated against sensitive content (see Guardrailing).

The embeddings API allows you to embed sentences.

  • python

from nido.client import NidoClient

api_key = os.environ["NIDO_API_KEY"]
client = NidoClient(api_key=api_key)

embeddings_batch_response = client.embeddings(
      model="nido-embed",
      input=["Embed this sentence.", "As well as this one."],
  )

Third-Party Clients

Here are some clients built by the community for various other languages:

Embeddings

Go

​
​
​
​
Gage-Technologies