Skip to content

Commit

Permalink
chore: Namananand/ins 2251 separate queries mutation and actions for …
Browse files Browse the repository at this point in the history
…SDK and example (#38)

Because

- separate queries mutation and actions for SDK and example 

This commit

- separate queries mutation and actions for SDK and example
  • Loading branch information
iamnamananand996 authored Oct 19, 2023
1 parent 3422f66 commit 5ed98b1
Show file tree
Hide file tree
Showing 33 changed files with 2,515 additions and 1,441 deletions.
112 changes: 106 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function TypescriptSdkDemo() {
const client = new InstillClient(
"http://localhost:8080",
"v1alpha",
"" // get console API token from `http://localhost:3000/settings`
"<your_api_token>" // get console API token from `http://localhost:3000/settings`
);
useEffect(() => {
Expand Down Expand Up @@ -110,7 +110,7 @@ export default function TypescriptSdkDemo() {
const client = new InstillClient(
"https://api.instill.tech",
"v1alpha",
"" // console API token
"<your_api_token>" // console API token
);
useEffect(() => {
Expand Down Expand Up @@ -164,6 +164,70 @@ export default function TypescriptSdkDemo() {

### Pipelines

### create Pipeline

```
userName : check your userName: https://console.instill.tech/settings
client.PipelineClient.createUserPipelineMutation("<userName>",
{
"id": "overseas-blue-lobster",
"recipe": {
"version": "v1alpha",
"components": [
{
"id": "start",
"resource_name": "",
"configuration": {
"metadata": {
"text": {
"type": "text",
"title": "text"
}
}
},
"definition_name": "operator-definitions/op-start"
},
{
"id": "end",
"resource_name": "",
"configuration": {
"metadata": {
"output": {
"title": "output"
}
},
"input": {
"output": "{ai_1.output.texts}"
}
},
"definition_name": "operator-definitions/op-end"
},
{
"id": "ai_1",
"resource_name": "users/namananand-instill-ai/connector-resources/ai2",
"configuration": {
"task": "TASK_TEXT_GENERATION",
"input": {
"prompt": "{start.text}",
"model": "gpt-3.5-turbo"
}
},
"definition_name": "connector-definitions/ai-openai"
}
]
}
}
).then((response) => {
console.log(response.data)
})
.catch(error => {
console.log(error)
})
```

| function | params |
| :------------------------------------ | :---------------------------------------------: |
| listPipelinesQuery | pageSize, nextPageToken |
Expand All @@ -188,15 +252,37 @@ export default function TypescriptSdkDemo() {

### Connector

### Create new connector

```
userName : check your userName: https://console.instill.tech/settings
query.ConnectorClient.createUserConnectorResourceMutation("<userName>",
{
"id": "open-ai-model-1",
"connector_definition_name": "connector-definitions/ai-openai",
"configuration": {
"organization": "my-org",
"api_key": "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"
}
}
).then((response) => {
console.log(response.data)
})
.catch(error => {
console.log(error)
})
```

| function | params |
| :---------------------------------------- | :---------------------------------------: |
| listConnectorResourcesQuery | userName, pageSize, nextPageToken, filter |
| listUserConnectorResourcesQuery | pageSize, nextPageToken, filter |
| listConnectorDefinitionsQuery | connectorDefinitionName |
| getConnectorDefinitionQuery | connectorDefinitionName |
| getUserConnectorResourceQuery | connectorDefinitionName |
| watchUserConnectorResource | userName, payload |
| createUserConnectorResourceMutation | connectorDefinitionName |
| watchUserConnectorResource | connectorResourceName |
| createUserConnectorResourceMutation | userName, payload |
| deleteUserConnectorResourceMutation | payload |
| updateUserConnectorResourceMutation | payload |
| renameUserConnectorResource | payload |
Expand All @@ -212,8 +298,6 @@ export default function TypescriptSdkDemo() {
| listTriggeredPipelineQuery | pageSize, nextPageToken, filter |
| listTriggeredPipelineChartQuery | pageSize, nextPageToken, filter |

modelDefinitionName,

### Model

| function | params |
Expand All @@ -240,6 +324,22 @@ modelDefinitionName,

### Mgmt

### create API token

```
client.AuthClient.createApiTokenMutation({
"id": "aa",
"ttl": -1
}).then((response) => {
console.log(response.data)
})
.catch(error => {
console.log(error)
})
```

| function | params |
| :--------------------- | :---------------------: |
| getUserQuery | |
Expand Down
2 changes: 1 addition & 1 deletion examples/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@instill-ai/typescript-sdk": "0.0.8-rc.12",
"@instill-ai/typescript-sdk": "0.0.11-rc.0",
"next": "latest",
"react": "latest",
"react-dom": "latest"
Expand Down
Loading

0 comments on commit 5ed98b1

Please sign in to comment.