Skip to content

Commit

Permalink
v0.3.56
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jun 5, 2024
1 parent e49a312 commit d2fd3ec
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 10 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ console.log(response.document_chunks)

## Repositories
Repositories act as storage for documents, organized to facilitate efficient information retrieval. Manipulating repository content is straightforward.
### Repository creation
To create a repository, you can use the `create` method provided by the `repositories` API. Here's an example of how to create a repository:
```typescript
const response = await client.repositories.create({
name: "Test",
description: "Test Repository",
organization: "org-test@premai.io"
})
```
### Document creation
To add a document to a repository, you can use the `create` method provided by the `document` API. Here's an example of how to create and upload a document:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@premai/prem-sdk",
"version": "0.3.55",
"version": "0.3.56",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PremBaseConfig } from "$types/index"
import chatcompletionsModule from "$modules/chat.completions"
import embeddingsModule from "$modules/embeddings"
import modelsModule from "$modules/models"
import repositoriesModule from "$modules/repositories"
import repositorydocumentModule from "$modules/repository.document"
import feedbacksModule from "$modules/feedbacks"
import tracesModule from "$modules/traces"
Expand All @@ -15,6 +16,7 @@ export default class Prem {
chat = { completions: new chatcompletionsModule(this) }
embeddings = new embeddingsModule(this)
models = new modelsModule(this)
repositories = new repositoriesModule(this)
repository = { document: new repositorydocumentModule(this) }
feedbacks = new feedbacksModule(this)
traces = new tracesModule(this)
Expand Down
7 changes: 7 additions & 0 deletions src/modules/repositories/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { APIModule } from "$components/index"

import v1_repositories_create from "./operations/v1_repositories_create"

export default class extends APIModule {
create = v1_repositories_create(this.client)
}
12 changes: 12 additions & 0 deletions src/modules/repositories/operations/v1_repositories_create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AxiosRequestConfig } from "axios"
import Prem from "$src/index"
import type { operations } from "$types/api"

export default (client: Prem) => (params: operations["v1_repositories_create"]["requestBody"]["content"]["application/json"], options?: AxiosRequestConfig): Promise<operations["v1_repositories_create"]["responses"]["201"]["content"]["application/json"]> => {
return client.call({
method: "post",
url: `/v1/repositories/`,
data: params,
...options
})
}
63 changes: 57 additions & 6 deletions src/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface paths {
"/v1/models/{id}/": {
get: operations["v1_models_retrieve"];
};
"/v1/repositories/": {
post: operations["v1_repositories_create"];
};
"/v1/repository/{repository_id}/document": {
post: operations["v1_repository_document_create"];
};
Expand Down Expand Up @@ -426,9 +429,10 @@ export interface components {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
model_type?: "text2text" | "text2image" | "text2vector";
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot";
model_provider?: ("openai" | "azure" | "azure-mistral" | "cohere" | "anthropic" | "cloudflare" | "deepinfra" | "lamini" | "octoai" | "replicate" | "together" | "fireworksai" | "mistralai" | "prem" | "anyscale" | "openrouter" | "perplexity" | "groq") | "" | null;
deprecated?: boolean;
};
Expand Down Expand Up @@ -471,9 +475,10 @@ export interface components {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
ModelTypeEnum: "text2text" | "text2image" | "text2vector";
ModelTypeEnum: "text2text" | "text2image" | "text2vector" | "autopilot";
NotFoundError: OneOf<[{
message: string;
/**
Expand Down Expand Up @@ -588,6 +593,12 @@ export interface components {
* @enum {string}
*/
RateLimitErrorCodeEnum: "RateLimitError";
Repository: {
id: number;
name: string;
description?: string | null;
organization: string;
};
ResponseChoice: {
/** @description The index of the choice in the list of choices. */
index: number;
Expand Down Expand Up @@ -677,9 +688,10 @@ export interface components {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
model_type?: "text2text" | "text2image" | "text2vector";
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot";
model_provider?: ("openai" | "azure" | "azure-mistral" | "cohere" | "anthropic" | "cloudflare" | "deepinfra" | "lamini" | "octoai" | "replicate" | "together" | "fireworksai" | "mistralai" | "prem" | "anyscale" | "openrouter" | "perplexity" | "groq") | "" | null;
deprecated?: boolean;
};
Expand Down Expand Up @@ -1367,9 +1379,10 @@ export interface operations {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
model_type?: "text2text" | "text2image" | "text2vector";
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot";
model_provider?: ("openai" | "azure" | "azure-mistral" | "cohere" | "anthropic" | "cloudflare" | "deepinfra" | "lamini" | "octoai" | "replicate" | "together" | "fireworksai" | "mistralai" | "prem" | "anyscale" | "openrouter" | "perplexity" | "groq") | "" | null;
deprecated?: boolean;
})[];
Expand All @@ -1394,16 +1407,53 @@ export interface operations {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
model_type?: "text2text" | "text2image" | "text2vector";
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot";
model_provider?: ("openai" | "azure" | "azure-mistral" | "cohere" | "anthropic" | "cloudflare" | "deepinfra" | "lamini" | "octoai" | "replicate" | "together" | "fireworksai" | "mistralai" | "prem" | "anyscale" | "openrouter" | "perplexity" | "groq") | "" | null;
deprecated?: boolean;
};
};
};
};
};
v1_repositories_create: {
requestBody: {
content: {
"application/json": {
id: number;
name: string;
description?: string | null;
organization: string;
};
"application/x-www-form-urlencoded": {
id: number;
name: string;
description?: string | null;
organization: string;
};
"multipart/form-data": {
id: number;
name: string;
description?: string | null;
organization: string;
};
};
};
responses: {
201: {
content: {
"application/json": {
id: number;
name: string;
description?: string | null;
organization: string;
};
};
};
};
};
v1_repository_document_create: {
parameters: {
path: {
Expand Down Expand Up @@ -1596,9 +1646,10 @@ export interface operations {
* @description * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
* @enum {string}
*/
model_type?: "text2text" | "text2image" | "text2vector";
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot";
model_provider?: ("openai" | "azure" | "azure-mistral" | "cohere" | "anthropic" | "cloudflare" | "deepinfra" | "lamini" | "octoai" | "replicate" | "together" | "fireworksai" | "mistralai" | "prem" | "anyscale" | "openrouter" | "perplexity" | "groq") | "" | null;
deprecated?: boolean;
};
Expand Down
17 changes: 14 additions & 3 deletions src/types/apiComponents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ export type Model = {
* * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
*/
model_type?: "text2text" | "text2image" | "text2vector"
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot"
model_provider?:
| (
| "openai"
Expand Down Expand Up @@ -587,8 +588,9 @@ export type ModelProviderEnum =
* * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
*/
export type ModelTypeEnum = "text2text" | "text2image" | "text2vector"
export type ModelTypeEnum = "text2text" | "text2image" | "text2vector" | "autopilot"

export type NotFoundError =
| {
Expand Down Expand Up @@ -717,6 +719,14 @@ export type RateLimitError = {
*/
export type RateLimitErrorCodeEnum = "RateLimitError"

export type Repository = {
id: number
name: string
description?: string
organization: string
[k: string]: unknown
}

export type ResponseChoice = {
/**
* The index of the choice in the list of choices.
Expand Down Expand Up @@ -832,8 +842,9 @@ export type TraceRetrieve = {
* * `text2text` - Text to Text
* * `text2image` - Text to Image
* * `text2vector` - Text to Vector
* * `autopilot` - Autopilot
*/
model_type?: "text2text" | "text2image" | "text2vector"
model_type?: "text2text" | "text2image" | "text2vector" | "autopilot"
model_provider?:
| (
| "openai"
Expand Down

0 comments on commit d2fd3ec

Please sign in to comment.