Skip to content

Commit ef03afa

Browse files
committed
Don't require user agent
1 parent cec5c05 commit ef03afa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const axios = require('axios');
33
const collections = require('./lib/collections');
44
const models = require('./lib/models');
55
const predictions = require('./lib/predictions');
6+
const packageJSON = require('./package.json');
67

78
/**
89
* Replicate API client library
@@ -28,12 +29,13 @@ class Replicate {
2829
*
2930
* @param {object} options - Configuration options for the client
3031
* @param {string} options.auth - Required. API access token
31-
* @param {string} options.userAgent - Required. Identifier of your app
32+
* @param {string} options.userAgent - Identifier of your app
3233
* @param {string} [options.baseUrl] - Defaults to https://api.replicate.com/v1
3334
*/
3435
constructor(options) {
3536
this.auth = options.auth;
36-
this.userAgent = options.userAgent;
37+
this.userAgent =
38+
options.userAgent || `replicate-javascript/${packageJSON.version}`;
3739
this.baseUrl = options.baseUrl || 'https://api.replicate.com/v1';
3840
this.instance = axios.create({
3941
baseURL: this.baseUrl,

0 commit comments

Comments
 (0)