Skip to content

Commit

Permalink
improved docs (ordering, corrections) (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
sohamganatra authored Aug 12, 2024
1 parent 18ded29 commit 5b7992d
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ description: "The Composio coding cookbook contain in-depth examples and code.
These examples can be used as reference to better understand the core principles and applications of composio."
---
<CardGroup cols={2}>
<Card color="#7bee0c" title="Python Examples" icon="python" href="/guides/python/investment-analyst">
<Card color="#7bee0c" title="Python Examples" icon="python" href="/guides/python/">

</Card >
<Card color="#7bee0c" title="Javascript Examples" icon="js" href="/guides/javascript/interpreter-agent">
<Card color="#7bee0c" title="Javascript Examples" icon="js" href="/guides/javascript/">

</Card>
</CardGroup>
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions docs/introduction/foundations/basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Goal of this section is to give you a brief walkthrough of each component and ho

| Component | Description | Examples |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Entity | Entity is a **catch all term for your users** which can be of type `individuals`, `teams`, `organisations`. | Melissa, Sam, ABC Corp, etc |
| ConnectedAccounts | Connections represent **link between your app and third-party platforms accounts of your user**. | Melissa's Github account after completing auth with integration, Similarly Sam's Hubspot account. |
| Integrations | Integrations are customisable configurations (settings) that are used while creating a new connected account. | Github Integration that that will ask Melissa for private repo permission|
| Tools | Tools refer to the various applications or tools that can be integrated and used by your agents via Composio. | Shell manager, Hubspot, Github, Slack & many others |
| Actions | Actions are tasks that can be performed by your agents.| Send email via Gmail, Send email via Outlook, Send email via Sendgrid, etc |
| Triggers | Triggers are predefined conditions that, when met, initiate webhooks to your agents. | New Github Issue, New Github Pull Request, New Github Release, New Hubspot Ticket, New Hubspot Case, etc |
| Entity | Entity represents the user and all accounts that belong to a specific user will have same entity id. &nbsp; [Learn More...](./components/entity/entity-guide) | Entity could be Melissa, Sam, ABC Corp, etc |
| ConnectedAccounts | Connections represent **link between your app and third-party platforms accounts of your user**. &nbsp; [Learn More...](./components/entity/entity-guide) | Melissa's Github account after completing auth with integration, Similarly Sam's Hubspot account. |
| Integrations | Integrations are customisable configurations (settings) that are used while creating a new connected account. &nbsp; [Learn More...](./components/integrations/integration-guide) | Github Integration that that will ask Melissa for private repo permission|
| Tools | Tools refer to the various applications or tools that can be integrated and used by your agents via Composio. &nbsp; [Learn More...](./components/tools/tool-guide) | Shell manager, Hubspot, Github, Slack & many others |
| Actions | Actions are tasks that can be performed by your agents. &nbsp; [Learn More...](./components/actions/action-guide) | Send email via Gmail, Send email via Outlook, Send email via Sendgrid, etc |
| Triggers | Triggers are predefined conditions that, when met, initiate webhooks to your agents. &nbsp; [Learn More...](./components/triggers/trigger-guide) | New Github Issue, New Github Pull Request, New Github Release, New Hubspot Ticket, New Hubspot Case, etc |


In next few pages, we can go through each component in detail. They will explain how to use each component in the code and what the expected flow should look like.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Check out the coding guides provided in the examples section to have a better un

tool_set = ComposioToolSet()

tools = tool_set.getActions(actions=[Action.GITHUB_CREATE_ISSUE])
tools = tool_set.get_tools(actions=[Action.GITHUB_CREATE_AN_ISSUE])

print(tools)
```
Expand Down Expand Up @@ -130,7 +130,9 @@ Check out the coding guides provided in the examples section to have a better un

use_case="Star a repo on github"

action_enums=toolset.find_actions_by_use_case(app=App.GITHUB, use_case=use_case)
# can pass multiple apps
action_enums=tool_set.find_actions_by_use_case(App.GITHUB,App.SLACK,use_case=use_case)

tools = toolset.get_actions(actions=action_enums)

# use tools as per your framework
Expand Down
44 changes: 31 additions & 13 deletions docs/introduction/foundations/components/entity/entity-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ from composio import ComposioToolSet

toolset = ComposioToolSet(entity_id="default")

entity = toolset.getEntity(id='default')
entity = toolset.get_entity(id='default')
```
</CodeGroup>
</Tab>
Expand Down Expand Up @@ -269,13 +269,13 @@ openai_client = OpenAI()
# can be configured to use the entity id of the user
tool_set = ComposioToolSet(entity_id="melissa")

actions = z.get_actions(app_name = App.GITHUB)
actions = tool_set.get_tools(apps=[App.GITHUB])
```
</CodeGroup>
</Tab>
<Tab title="Javascript">
<CodeGroup>
```python Execute Agent
```javascript Execute Agent
import { OpenAIToolSet } from "composio-core";
import { OpenAI } from "openai";

Expand Down Expand Up @@ -332,18 +332,36 @@ Now, let's call our agent for this entity to perform the task on Github on behal
<Tab title="Python">
<CodeGroup>
```python execute agent
const task = "Star a repo composiohq/composio on GitHub"

const response = await openAI.chat.completions.create({
model: "gpt-4-turbo-preview",
tools: tools,
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: task },
],
});
my_task = "Star a repo composiohq/composio on GitHub"

# Setup openai assistant
assistant_instruction = "You are a super intelligent personal assistant"

assistant = openai_client.beta.assistants.create(
name="Personal Assistant",
instructions=assistant_instruction,
model="gpt-4-turbo-preview",
tools=actions, # type: ignore
)


# create a thread
thread = openai_client.beta.threads.create()
message = openai_client.beta.threads.messages.create(thread_id=thread.id,role="user",content=my_task)

# Execute Agent with integrations
run = openai_client.beta.threads.runs.create(thread_id=thread.id,assistant_id=assistant.id)
response_after_tool_calls = tool_set.wait_and_handle_assistant_tool_calls(
client=openai_client,
run=run,
thread=thread,
)

print(response_after_tool_calls)



await toolset.handle_tool_calls(response, entity.id);
```
</CodeGroup>

Expand Down
6 changes: 0 additions & 6 deletions docs/introduction/foundations/howtos/install.mdx

This file was deleted.

6 changes: 0 additions & 6 deletions docs/introduction/foundations/production/install.mdx

This file was deleted.

67 changes: 39 additions & 28 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"thumbsRating": true
},
"search": {
"prompt": "Make my agents useful _/\\_ ..."
"prompt": "Make my agents useful ..."
},
"metadata": {
"og:image": "https://framerusercontent.com/images/YwaNXXQETYRs9LymxFCnTjp83Q.svg",
Expand Down Expand Up @@ -65,7 +65,7 @@
},
{
"name": "Examples",
"url": "guides"
"url": "examples"
},
{
"name": "API",
Expand All @@ -84,7 +84,6 @@
"group": "Core Concepts",
"pages": [
"introduction/foundations/basic",
"introduction/foundations/howtos/get_api_key",
"introduction/foundations/components/entity/entity-guide",
"introduction/foundations/components/integrations/integration-guide",
"introduction/foundations/components/actions/action-guide",
Expand Down Expand Up @@ -138,29 +137,21 @@
]
},
{
"group": "CLI",
"group": "SweKit (JS)",
"pages": [
"sdk/cli/install",
"sdk/cli/trigger"
"swekit-js/introduction",
"swekit-js/workspace-env"
]
},
{
"group": "SweKit",
"group": "SweKit (Python)",
"pages": [
"swekit/introduction",
"swekit/workspace-env",
"swekit/custom-tools",
"swekit/benchmarks"
]
},
{
"group": "SweKit.js",
"pages": [
"swekit-js/introduction",
"swekit-js/workspace-env"
]
},

{
"group": "Guides",
"pages": [
Expand All @@ -171,9 +162,17 @@
"patterns/functions/triggers"
]
},
{
"group": "Using CLI",
"pages": [
"patterns/cli/install",
"patterns/cli/trigger"
]
},
{
"group": "How Tos",
"pages": [
"patterns/howtos/get_api_key",
"patterns/howtos/usecase",
"patterns/howtos/tool-finding",
"patterns/howtos/listing-connections",
Expand All @@ -191,27 +190,27 @@
{
"group": "Examples",
"pages": [
"guides/examples/Example",
"examples/examples/Example",
{
"group": "Python Guides",
"pages":[
"guides/python/investment-analyst",
"guides/python/research-assistant",
"guides/python/sql-agent",
"guides/python/competitor-researcher",
"guides/python/rag_agent",
"guides/python/interpreter_agent",
"guides/python/news-summary",
"guides/python/calendar-agent"
"examples/python/investment-analyst",
"examples/python/research-assistant",
"examples/python/sql-agent",
"examples/python/competitor-researcher",
"examples/python/rag_agent",
"examples/python/interpreter_agent",
"examples/python/news-summary",
"examples/python/calendar-agent"
]
},
{
"group":"Javascript Guides",
"pages":[
"guides/javascript/calendar-agent",
"guides/javascript/code-execution-agent",
"guides/javascript/rag_agent",
"guides/javascript/investment-analyst"
"examples/javascript/calendar-agent",
"examples/javascript/code-execution-agent",
"examples/javascript/rag_agent",
"examples/javascript/investment-analyst"
]
}
]
Expand Down Expand Up @@ -283,6 +282,18 @@
}
},
"redirects": [
{
"source": "/introduction/foundations/howtos/get_api_key",
"destination": "/patterns/howtos/get_api_key"
},
{
"source": "/sdk/cli/trigger",
"destination": "/patterns/cli/trigger"
},
{
"source": "/guides/:slug1*",
"destination": "/examples/:slug1*"
},
{
"source": "/apps/usecases/langchain_blogs/:slug2*",
"destination": "https://composio.dev/tools/:slug2*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5b7992d

Please sign in to comment.