Skip to content

Commit

Permalink
fix docs (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
sohamganatra authored Jul 31, 2024
1 parent abc846c commit e623db6
Show file tree
Hide file tree
Showing 19 changed files with 381 additions and 226 deletions.
2 changes: 0 additions & 2 deletions docs/guides/examples/Example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ These examples can be used as reference to better understand the core principles
<Card color="#7bee0c" title="Javascript Examples" icon="js" href="/guides/javascript/interpreter-agent">

</Card>


</CardGroup>

2 changes: 1 addition & 1 deletion docs/guides/javascript/investment-analyst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This project involves setting up and running an agent to conduct investment rese
<Step title="Project Setup">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/javascript/investment_analyst`
`cd js/docs-example/investment_analyst`

Install the required dependencies:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/javascript/rag_agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This project involves setting up and running an agent to add content to a RAG (R
<Step title="Project Setup">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/javascript/investment_analyst`
`cd js/examples/docs-example/rag_tool_agent`

Install the required dependencies:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/calendar-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This project is an example which uses Composio to seamlessly convert your to-do
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/calendar_agent`
`cd python/examples/calendar_agent`


Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/competitor-researcher.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This project uses Composio to automate the creation and management of competitor
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/competitor_researcher`
`cd python/examples/competitor_researcher`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/investment-analyst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This project involves setting up and running a system of agents to conduct inves
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/investment_analyst`
`cd python/examples/investment_analyst`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/news-summary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ retrieves the latest news articles and generates summaries using Langchain and C
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/news_summary`
`cd python/examples/news_summary`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/research-assistant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: "This guide provides detailed steps to create a research assistant
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/research_assistant`
`cd python/examples/research_assistant`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/sql-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This project involves setting up and running a system of agents to conduct SQL q
<Step title="Run the `setup.sh` file">
> Fork and Clone this [repository](https://git.new/composio), Navigate to the Project Directory
`cd cookbook/examples/python/sql_agent`
`cd python/examples/sql_agent`

Make the setup.sh Script Executable (if necessary): On Linux or macOS, you might need to make the setup.sh script executable:
<CodeGroup>
Expand Down
134 changes: 79 additions & 55 deletions docs/introduction/intro/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,58 @@ description: "Use Composio to connect OpenAI Assistant to GitHub (via OAUTH2) to
<Steps>

<Step title="Install Composio Package">
<Tabs>
<Tab title="Python">
<CodeGroup>
```bash python
```bash Install Composio Package
pip install composio_core
pip install composio_openai
```
</CodeGroup>
</Tab>

```javascript javascript
<Tab title="JS">
<CodeGroup>
```javascript Install Composio Package
npm install composio-core
npm install openai
pip install composio_core // for installing CLI via python.
// We will soon release a binary package for CLI. 😅
// This step can be skipped if you don't intend to use the CLI.
```
</CodeGroup>
<Note> CLI binary package coming soon. Skip if not using CLI. </Note>
</Tab>
</Tabs>

</Step>
<Step title="Authenticate your github account using CLI">
<CodeGroup>
```bash Authenticate your Github Account
composio add github
```
</CodeGroup>

</Step>
<Step title="Import python packages">
Modify `OPENAIKEY` and `COMPOSIO_API_KEY` before executing it.
<Step title="Import packages and initialize clients">
<Note>Modify `OPENAIKEY` and `COMPOSIO_API_KEY` before executing it.</Note>
<Tabs>
<Tab title="Python">
<CodeGroup>
```python python
```python Initialise the Composio Tool Set
from openai import OpenAI
from composio_openai import ComposioToolSet, App, Action

openai_client = OpenAI(api_key="**\*\***OPENAIKEY**\*\***")

# Initialise the Composio Tool Set

composio_toolset = ComposioToolSet(api_key="**\*\***COMPOSIO_API_KEY**\*\***")
composio_toolset = ComposioToolSet()

# composio_toolset = ComposioToolSet(api_key=COMPOSIO_API_KEY)
# Only need to pass API key if you are not using CLI
```
```javascript javascript
</CodeGroup>
</Tab>
<Tab title="JS">
<CodeGroup>
```javascript Initialise the Composio Tool Set
import dotenv from 'dotenv';
dotenv.config();

Expand All @@ -63,30 +78,39 @@ const composio_toolset = new OpenAIToolSet({
apiKey: process.env.COMPOSIO_API_KEY
});
```

</CodeGroup>
</Tab>
</Tabs>

</Step>

<Step title="Fetch all Github actions via Composio">
<CodeGroup>
```python python
# Get GitHub tools that are pre-configured
<Tabs>
<Tab title="Python">
<CodeGroup>
```python Get GitHub action for starring a repo
actions = composio_toolset.get_actions(actions=[Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER])
```

```javascript javascript
// Get GitHub tools that are pre-configured
const tools = await composio_toolset.getActions({
actions: ["github_start_repo"]
});
```
</CodeGroup>
</Step>
```
</CodeGroup>
</Tab>
<Tab title="JS">
<CodeGroup>
```javascript Get GitHub action for starring a repo
const tools = await composio_toolset.getActions({
actions: ["github_start_repo"]
});
```
</CodeGroup>
</Tab>
</Tabs>

<Step title="Using Function Call">
</Step>

<Step title="Pass those actions to LLM">
<Tabs>
<Tab title="Python">
<CodeGroup>
```python python
```python Star a repository using LLM
my_task = "Star a repo composiohq/composio on GitHub"

# Setup openai assistant
Expand All @@ -108,8 +132,11 @@ message = openai_client.beta.threads.messages.create(thread_id=thread.id,role="u
run = openai_client.beta.threads.runs.create(thread_id=thread.id,assistant_id=assistant.id)

```

```javascript javascript
</CodeGroup>
</Tab>
<Tab title="JS">
<CodeGroup>
```javascript Star a repository using LLM
const instruction = "Star a repo composiohq/composio on GitHub";

// Initialise the Composio Tool Set
Expand All @@ -122,14 +149,16 @@ const response = await openai_client.chat.completions.create({

```
</CodeGroup>
</Tab>
</Tabs>

</Step>

<Step title="Handle Tool Calls - Execute Actions">
<Tabs>
<Tab title="Default">
<Tab title="Python">
<CodeGroup>
```python python
# Execute Function calls
```python Execute Function calls
response_after_tool_calls = composio_toolset.wait_and_handle_assistant_tool_calls(
client=openai_client,
run=run,
Expand All @@ -138,8 +167,11 @@ response_after_tool_calls = composio_toolset.wait_and_handle_assistant_tool_call

print(response_after_tool_calls)
```

```javascript javascript
</CodeGroup>
</Tab>
<Tab title="JS">
<CodeGroup>
```javascript Execute Function calls
var resp = response.choices[0].message.tool_calls
console.log(resp);

Expand All @@ -148,34 +180,21 @@ await composio_toolset.handle_tool_call(response);
```
</CodeGroup>
</Tab>
<Tab title="Execute actions for Specific User">
You can checkout adding connections for your user [here](/introduction/foundations/components/integrations/connected-account)
<CodeGroup>
```python Executing Selected Actions!
# Execute Function calls
response_after_tool_calls = composio_toolset.wait_and_handle_assistant_tool_calls(
client=openai_client,
run=run,
thread=thread,
)

url = f"https://platform.openai.com/playground/assistants?assistant={assistant.id}&thread={thread.id}"
print(f"Open this URL to see the assistant in action: {url}")
print(response_after_tool_calls)
```
</CodeGroup>
</Tab>
</Tabs>

<Note>You can checkout docs on adding connections or executing actions for a specific user [here](/introduction/foundations/components/entity/entity-guide)</Note>

</Step>

</Steps>

### Putting it all together

Replace `OPENAIKEY`.

<Tabs>
<Tab title="Python">
<CodeGroup>
```python python
```python Complete Code
## Step 1
#!pip install composio_core
#!pip install composio_openai
Expand Down Expand Up @@ -223,8 +242,11 @@ url = f"https://platform.openai.com/playground/assistants?assistant={assistant.i
print(f"Open this URL to see the assistant in action: {url}")
print(response_after_tool_calls)
```

```javascript javascript
</CodeGroup>
</Tab>
<Tab title="JS">
<CodeGroup>
```javascript Complete Code
// Importing necessary modules from the openai and composio-core packages
import dotenv from 'dotenv';
dotenv.config();
Expand Down Expand Up @@ -268,3 +290,5 @@ await composio_toolset.handle_tool_call(response);

```
</CodeGroup>
</Tab>
</Tabs>
26 changes: 13 additions & 13 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"isHidden": false
},
"feedback": {
"suggestEdit": false,
"suggestEdit": true,
"raiseIssue": true,
"thumbsRating": true
},
Expand Down Expand Up @@ -99,6 +99,7 @@
{
"group": "Python",
"pages": [
"python/introduction",
{
"group": "With Frameworks",
"icon": "code",
Expand All @@ -116,8 +117,7 @@
"framework/praisonai",
"framework/langgraph"
]
},
"python/introduction"
}
]
},
{
Expand All @@ -136,6 +136,13 @@
}
]
},
{
"group": "CLI",
"pages": [
"sdk/cli/install",
"sdk/cli/trigger"
]
},
{
"group": "SweKit",
"pages": [
Expand All @@ -152,15 +159,7 @@
"swekit-js/workspace-env"
]
},
{
"group": "CLI",
"pages": [
"sdk/cli/install",
"sdk/cli/account",
"sdk/cli/trigger",
"sdk/cli/actions"
]
},

{
"group": "Guides",
"pages": [
Expand All @@ -176,7 +175,8 @@
"pages": [
"patterns/howtos/usecase",
"patterns/howtos/tool-finding",
"patterns/howtos/listing-connections"
"patterns/howtos/listing-connections",
"patterns/howtos/listing-integrations"
]
},
{
Expand Down
Loading

0 comments on commit e623db6

Please sign in to comment.