Skip to content

Commit

Permalink
docs: standardize entity id and execute method format in documentation (
Browse files Browse the repository at this point in the history
#1101)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Soham Ganatra <[email protected]>
Co-authored-by: Abhishek Patil <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent b8532ee commit 4cf51bc
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 55 deletions.
40 changes: 17 additions & 23 deletions docs/introduction/intro/quickstart-entities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Follow these 5 steps to connect your user to Google Calendar and create an event
</Step>

<Step title="Authenticate Google Calendar Account">
We'll use Jessica as our example user. There are multiple ways to authenticate an account:
We'll use **`default`** as our example user. There are multiple ways to authenticate an account:
<Tabs>
<Tab title="Python">
<CodeGroup>
```python Authenticate Jessica's Google Calendar Account
```python Authenticate Google Calendar Account
from composio import ComposioToolSet, App

toolset = ComposioToolSet(entity_id="Jessica")
toolset = ComposioToolSet(entity_id="default")
entity = toolset.get_entity()
request = entity.initiate_connection(App.GOOGLECALENDAR)

Expand All @@ -74,7 +74,7 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a
from openai import OpenAI

openai_client = OpenAI()
composio_toolset = ComposioToolSet(entity_id="Jessica")
composio_toolset = ComposioToolSet(entity_id="default")
```
</CodeGroup>

Expand Down Expand Up @@ -144,24 +144,24 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a
</Step>

<Step title="Authenticate Google Calendar Account">
We'll use Jessica as our example user. There are multiple ways to authenticate an account:
We'll use **`default`** as our example user. There are multiple ways to authenticate an account:
<Tabs>
<Tab title="CLI">
<CodeGroup>
```bash Authenticate Jessica's Google Calendar Account
composio add googlecalendar -e "Jessica" # Launches Google Calendar login
```bash Authenticate Google Calendar Account
composio add googlecalendar -e "default" # Launches Google Calendar login
```
</CodeGroup>
</Tab>
<Tab title="JavaScript">
<CodeGroup>
```javascript Authenticate Jessica's Google Calendar Account
```javascript Authenticate Google Calendar Account
import { Composio } from "composio-core";

const client = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });

const entity = await client.getEntity("Jessica");
const connection = await entity.initiateConnection({appName: "googlecalendar"});
const entity = await client.getEntity("default");
const connection = await entity.initiateConnection('googlecalendar');

console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
```
Expand All @@ -177,17 +177,11 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a

</Step>

<Step title="Initialize Composio Toolset and OpenAI">
<Step title="Initialize Composio's OpenAIToolset and OpenAI">
Set up your development environment:

<CodeGroup>
<<<<<<< HEAD
```javascript Initialize Composio Toolset and OpenAI
||||||| 0378f58b
```javascript Initialize Composio and OpenAI
=======
```javascript Initialize Composio's OpenAI Toolset and OpenAI
>>>>>>> 44f9adb9f45a48b9ce6bd352c62a5a39f9b74a23
```javascript Initialize Composio's OpenAIToolset and OpenAI
import { OpenAI } from "openai";
import { OpenAIToolSet } from "composio-core";

Expand All @@ -197,7 +191,7 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a

const composio_toolset = new OpenAIToolSet({
apiKey: process.env.COMPOSIO_API_KEY,
entityId: "Jessica",
entityId: "default",
});
```
</CodeGroup>
Expand Down Expand Up @@ -251,10 +245,10 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a
<Tab title="CLI">
<Steps>
<Step title="Authenticate Google Calendar Account">
We'll use Jessica as our example user. There are multiple ways to authenticate an account:
We'll use **`default`** as our example user. There are multiple ways to authenticate an account:
<CodeGroup>
```bash Authenticate Jessica's Google Calendar Account
composio add googlecalendar -e "Jessica" # Launches Google Calendar login
```bash Authenticate Google Calendar Account
composio add googlecalendar -e "default" # Launches Google Calendar login
```
</CodeGroup>
<Warning>
Expand Down Expand Up @@ -287,7 +281,7 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a
--header 'X-API-Key: ADD YOUR API KEY HERE' \
--data '{
"appName": "GOOGLECALENDAR", #add your app name here
"entityId": "Jessica", #add your entity id here
"entityId": "default", #add your entity id here
"input": {
"start_datetime": "11:15 PM, 1 December 2024",
"event_duration": "2h"
Expand Down
12 changes: 6 additions & 6 deletions docs/introduction/intro/quickstart-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ pip install composio_core composio_openai
</Step>

<Step title="Connect Your GitHub Account">
We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities).
We'll use **`default`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities).
<Info>You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf)</Info>
<CodeGroup>
```shell CLI
composio login
composio add github -e "Jessica"
composio add github -e "default"
```
```python Python
from composio_openai import ComposioToolSet, App, Trigger
toolset = ComposioToolSet(entity_id="Jessica")
toolset = ComposioToolSet(entity_id="default")

request = toolset.initiate_connection(app=App.GITHUB)

Expand All @@ -49,7 +49,7 @@ from composio_openai import ComposioToolSet, App
from openai import OpenAI

openai_client = OpenAI()
composio_toolset = ComposioToolSet(entity_id="Jessica")
composio_toolset = ComposioToolSet(entity_id="default")
```
</CodeGroup>
</Step>
Expand Down Expand Up @@ -100,7 +100,7 @@ print(result)
</Step>

<Step title="Connect Your GitHub Account">
We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities).
We'll use **`default`** as the user id [(entity id)](../../patterns/Auth/connected_account#entities).
<Info>You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf)</Info>
<CodeGroup>
```shell CLI
Expand All @@ -112,7 +112,7 @@ print(result)

const client = new Composio({ apiKey: "<your-api-key>" });

const entity = await client.getEntity("Jessica");
const entity = await client.getEntity("default");
const connection = await entity.initiateConnection({appName: 'github'});

console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
Expand Down
12 changes: 6 additions & 6 deletions docs/introduction/intro/quickstart-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connect
<CodeGroup>
```shell CLI
composio login
composio add gmail -e "Jessica"
composio add gmail -e "default"
```
```python Python
from composio_openai import ComposioToolSet, App, Trigger
toolset = ComposioToolSet(entity_id="Jessica")
toolset = ComposioToolSet(entity_id="default")

request = toolset.initiate_connection(app=App.GMAIL)

Expand All @@ -45,7 +45,7 @@ Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environ
composio triggers enable gmail_new_gmail_message
```
```python Python
entity = toolset.get_entity(id="Jessica")
entity = toolset.get_entity(id="default")

entity.enable_trigger(
app=App.GMAIL,
Expand Down Expand Up @@ -121,7 +121,7 @@ We'll use **`Jessica`** as the user id [(entity id)](../../patterns/Auth/connect
<CodeGroup>
```shell CLI
composio login
composio add gmail -e "Jessica"
composio add gmail -e "default"
```
```javascript JavaScript
import { OpenAIToolSet, Composio } from "composio-core";
Expand All @@ -132,7 +132,7 @@ const openai_client = new OpenAI();

const connectionRequest = await toolset.client.connectedAccounts.initiate({
appName: "gmail",
entityId: "Jessica",
entityId: "default",
authMode: "OAUTH2",
authConfig: {},
});
Expand All @@ -150,7 +150,7 @@ Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environ
composio triggers enable gmail_new_gmail_message
```
```javascript JavaScript
const entity = toolset.client.getEntity("Jessica");
const entity = toolset.client.getEntity("default");

const response = await entity.setupTrigger("gmail", "gmail_new_gmail_message", {
userId: "me",
Expand Down
10 changes: 5 additions & 5 deletions docs/introduction/intro/quickstart_3_backup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ Follow these 5 steps to list your emails as soon as you receive them:
</Step>

<Step title="Authenticate Gmail Account">
We'll use **`Jessica`** as our example user. Choose your method:
We'll use **`default`** as our example user. Choose your method:

<Tabs>
<Tab title="CLI (Quickest)">
<CodeGroup>
```bash Authenticate Gmail Account
composio add gmail -e "Jessica" # Launches Gmail login
composio add gmail -e "default" # Launches Gmail login
```
</CodeGroup>
</Tab>
Expand All @@ -60,7 +60,7 @@ Follow these 5 steps to list your emails as soon as you receive them:
```python Authenticate Gmail Account
from composio import ComposioToolSet, App

toolset = ComposioToolSet(entity_id="Jessica")
toolset = ComposioToolSet(entity_id="default")
entity = toolset.get_entity()
request = entity.initiate_connection(App.GMAIL)

Expand All @@ -75,7 +75,7 @@ Follow these 5 steps to list your emails as soon as you receive them:

const client = new Composio(process.env.COMPOSIO_API_KEY);

const entity = await client.getEntity("Jessica");
const entity = await client.getEntity("default");
const connection = await entity.initiateConnection({appName: "gmail"});

console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
Expand Down Expand Up @@ -110,7 +110,7 @@ Follow these 5 steps to list your emails as soon as you receive them:
from composio import Composio, Action

client = Composio()
entity = client.get_entity(id="Jessica")
entity = client.get_entity(id="default")

# config is optional, it can be used to pass additional parameters for the trigger
entity.enable_trigger(app=App.GMAIL, trigger_name="gmail_new_gmail_message", config={}) # Enable trigger
Expand Down
10 changes: 5 additions & 5 deletions docs/patterns/Auth/Integrations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ You can create an integration using the SDK by following the steps below:
from composio import ComposioToolSet

toolset = ComposioToolSet()
entity = toolset.get_entity("Jessica")
entity = toolset.get_entity("default")
```
```javascript JavaScript
import { Composio } from "composio-core";

const toolset = new Composio();
const entity = toolset.getEntity("Jessica");
const entity = toolset.getEntity("default");
```
</CodeGroup>
</Step>
Expand Down Expand Up @@ -170,7 +170,7 @@ You can follow the same steps as mentioned in [Creating a new connection](/patte
```python Python
from composio import ComposioToolSet

toolset = ComposioToolSet(entity_id="Jessica")
toolset = ComposioToolSet(entity_id="default")

entity = toolset.get_entity()

Expand All @@ -194,7 +194,7 @@ const connectionRequest = await toolset.client.connectedAccounts.initiate({
appName: "gmail",
redirect_url: "https://yourwebsite.com/connection/success",
integrationId: integration.id,
entityId:"Jessica"
entityId:"default"
});

console.log(connectionRequest.redirectUrl);
Expand All @@ -214,4 +214,4 @@ When creating an integration, you can use your own OAuth Developer App instead o
When users connect using this integration, they'll see your app's name and logo in the OAuth consent screen instead of Composio's. Checkout the live demo [here](https://whitelabel-eight.vercel.app/)
</Info>

<img width="500" height="500" src="../../media/images/custom-oauth.png" />
<img width="500" height="500" src="../../media/images/custom-oauth.png" />
10 changes: 5 additions & 5 deletions docs/patterns/Auth/using-connections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: "Learn how to use connections"
toolset = ComposioToolSet()

# Filter based on entity id
entity = toolset.get_entity(id="Jessica")
entity = toolset.get_entity(id="default")
try:
# Lists all connections of the entity
connected_accounts = entity.get_connections()
Expand All @@ -24,7 +24,7 @@ description: "Learn how to use connections"
const toolset = new OpenAIToolSet();

// Filter based on entity id
const entity = await toolset.client.getEntity("Jessica")
const entity = await toolset.client.getEntity("default")

// lists all connections of the entity
const connected_accounts = await entity.getConnections()
Expand All @@ -46,7 +46,7 @@ description: "Learn how to use connections"
toolset = ComposioToolSet()

# Filter based on entity id
entity = toolset.get_entity(id="Jessica")
entity = toolset.get_entity(id="default")

try:
# Filters based on app name
Expand All @@ -62,7 +62,7 @@ description: "Learn how to use connections"
const toolset = new OpenAIToolSet();

// Filter based on entity id
const entity = await toolset.client.getEntity("Jessica")
const entity = await toolset.client.getEntity("default")

// Filters based on app name
const connectionDetails = await entity.getConnection({ appName: "GITHUB" })
Expand Down Expand Up @@ -152,4 +152,4 @@ Connected account raw auth params {

<Note>
You can fetch connection details after user is redirected back to your app (If redirect was needed) and `connectionStatus` & `connectedAccountId` will be available in the query params.
</Note>
</Note>
11 changes: 6 additions & 5 deletions docs/patterns/tools/use-tools/action-guide-without-agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tool_set.execute_action(
import { OpenAIToolSet } from "composio-core";

const toolset = new OpenAIToolSet();
const entity = toolset.client.getEntity("Jessica");
const entity = toolset.client.getEntity("default");

const result = await entity.execute({
actionName: "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
Expand All @@ -52,10 +52,11 @@ tool_set.execute_action(
```

```javascript JavaScript
const result = await toolset.client.getEntity("Jessica").execute({
actionName: "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
// Natural language prompt
text: "Star the repo composiohq/composio",
const result = await toolset.client.getEntity("default").execute({
actionName: "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER",
params: {},
// Natural language prompt
text: "Star the repo composiohq/composio"
});
console.log(result);
```
Expand Down

0 comments on commit 4cf51bc

Please sign in to comment.