GuidesRecipesAPI ReferenceChangelogDiscussions
Log In

How to Use a Project

The most important thing to know about a project is that it's basically a collection of all inference activity that is processed through a single API Key. So any any activity that you execute using your project API key will automatically show up in your project.

:lock: Download your project's API key

On the top right of your project page, click on the "Get Key" button to download your project API key. Using this key will ensure all inference jobs will be tied specifically to your project. Submitting jobs to models with this project API key will populate the "Active Models" component of the Project Overview dashboard. This will allow you to associate a subset of models in your instance to your specific project.

3104

Downloading a project API Key

:arrow-forward: Process inferences through your project

To start populating your project with activity, simply use your project's API Key to execute inference jobs. In the example below, we're sending some text to an open source Sentiment Analysis model, but this approach will work with any model deployed to Modzy. To use this example, you'll just need to make the following substitutions:

  • Replace API_KEY with the API Key you just downloaded from your project
  • Replace https://trial.app.modzy.com/ with the URL of your instance of Modzy
curl https://trial.app.modzy.com/api/jobs -X POST \
 -H 'Content-Type: application/json' \
 -H 'Authorization: ApiKey API_KEY' \
 -d '{
      "model": {
        "identifier": "ed542963de",
        "version": "1.0.1"
      },
      "input": {
        "type": "text",
        "sources": {
          "first-phone-call": {
            "input.txt": "Mr Watson, come here. I want to see you."
          }
        }
      }
    }'
import json
from modzy import ApiClient
from modzy._util import file_to_bytes

#Initialize your Modzy client
client = ApiClient(base_url="https://trial.app.modzy.com/api", api_key=API_KEY)

#Create a dictionary for your text input(s)
sources = {}

#Add any number of inputs
sources["first-phone-call"] = {
    "input.txt": "Mr Watson, come here. I want to see you.",
}

#Once you are ready, submit the job
job = client.jobs.submit_text("ed542963de", "1.0.1", sources)

#Print the response from your job submission
print(json.dumps(job))
const modzy = require("@modzy/modzy-sdk");

//Initialize the client
const modzyClient = new modzy.ModzyClient("https://trial.app.modzy.com/api", API_KEY)

let sources = {};
//Add any number of inputs
sources["first-phone-call"] = {
    "input.txt": "Mr Watson, come here. I want to see you.",
};

//Once you are ready, submit the job
modzyClient
  .submitJobText("ed542963de", "1.0.1", sources)
  .then(
    (job)=>{
      console.log(JSON.stringify(job));
    }
  )
  .catch(
    (error)=>{
      console.error("Modzy job submission failed with code " + error.code + " and message " + error.message);
    }
  );
package main

import (
    "context"
    "log"
    "time"

    modzy "github.com/modzy/sdk-go"
)

func main() {
    ctx := context.TODO()
  // Replace BASE_URL and API_KEY with valid values
    baseURL := "https://trial.app.modzy.com"
    apiKey := API_KEY

  // Initialize the API client
    client := modzy.NewClient(baseURL).WithAPIKey(apiKey)

  // Create a map with a single text input
    mapSource := map[string]modzy.TextInputItem{
        "first-phone-call": {
            "input.txt": "Mr Watson, come here. I want to see you.",
        },
    }

  // Send your input to the sentiment analysis model by specifying ID and version number
    submitResponse, _ := client.Jobs().SubmitJobText(ctx, &modzy.SubmitJobTextInput{
        ModelIdentifier: "ed542963de",
        ModelVersion:    "1.0.1",
        Inputs:          mapSource,
    })

  // Check on the status of your request to analyze the sentiment of your input once a second
    jobDetails, _ := submitResponse.WaitForCompletion(ctx, time.Second)

  //When the input is done processing, retrive the results from Modzy, and log them to your terminal
    if jobDetails.Details.Status == modzy.JobStatusCompleted {
        results, _ := submitResponse.GetResults(ctx)
        for key := range mapSource {
            if result, exists := results.Results.Results[key]; exists {
                log.Printf("    %s:\n", key)
                modelRes := result.Data["results.json"].(map[string]interface{})
                for key2, val2 := range modelRes {
                    log.Printf("    %s:%f\n", key2, val2)
                }
            }
        }
    }
}
package mysample;

import com.modzy.sdk.ModzyClient;
import com.modzy.sdk.model.Job;
import com.modzy.sdk.model.JobInput;
import com.modzy.sdk.model.JobInputStream;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

public class JobSample{

  public static void main(String args[]) throws Exception{
    ModzyClient modzyClient = new ModzyClient("https://trial.app.modzy.com/api", API_KEY);
    JobInput<String> jobInput = new JobInputText();
    Map<String,String> mapSource = new HashMap<>();
    //Add any number of inputs
    mapSource.put("input.txt", "Mr Watson, come here. I want to see you.");
    jobInput.addSource("first-phone-call", mapSource);
    //Once you are ready, submit the job
    Job job = modzyClient.getJobClient().submitJob("ed542963de", "1.0.1", jobInput);
    System.out.println(String.format("job: %s", job));
  }

}

Any data you submit for inference and any models you use in your project will automatically show up within your project.

:eyeglasses: View project inference results

Once you've submitted one or more inference jobs, you can see the results by clicking on your project's Job History tab.

3104

Example of project specific job history

:page-with-curl: Create a readme

To create a readme for your project, navigate to the Overview tab on your project and then scroll to the bottom. You'll see a button that says Edit Readme. Clicking on that button will allow you to create an editable readme page for your project that fully supports markdown formatting.

3104

An example of a project readme which uses markdown for formatting

📘

Use project readmes to capture important notes about your project

Project readmes are a great way to document useful information about your project. Examples include:

  • Documenting to-do lists of features you're planning to add to your Modzy-powered app
  • Including production information about where your app is running and what type of data it's processing
  • Sharing contact information so that your teammates know who to reach out to if they have questions about a project
  • Documenting important business drivers or goals related to a project