Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ENG 2785 conflict resolve #973

Merged
merged 19 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/framework/litellm.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "Using Composio With LiteLLM"
sidebarTitle: "LiteLLM"
icon: "people-group"
description: "Integrate Composio with LiteLLM and seamlessly interact with external apps"
---

## Star A Repository on Github
In this example, we will use LiteLLM to star a repository on Github using Composio Tools

<Steps>
<Step title="Install Packages">
```bash Python
pip install composio_openai litellm
```
</Step>
<Step title="Import Libraries, Initialize ComposioToolSet & Create Router">
```bash Python
from composio_openai import ComposioToolSet, App
from litellm.router import Router

toolset = ComposioToolSet()

router = Router(
model_list=[
{
"model_name": "anthropic/claude-3-5",
"litellm_params": {
"model": "claude-3-opus-20240229",
"api_key": "<your-anthropic-api-key>",
},
}
]
)
```
</Step>

<Step title="Get All Github Tools">
You can get all the tools for a given app as shown below, but you can get **specific actions** and filter actions using **usecase** & **tags**. Learn more [here](../../patterns/tools/use-tools/use-specific-actions)
<CodeGroup>
```python Python
tools = toolset.get_tools(apps=[App.GITHUB])
```
</CodeGroup>

</Step>
<Step title="Configure Router">
```python Python
response = router.completion(
model="anthropic/claude-3-5",
messages=[
{"role": "user", "content": "Star the repository composiohq/composio on github"},
],
tools=tools,
tool_choice="auto",
)
```
</Step>

<Step title="Execute Tool Calls">
```python Python
result = toolset.handle_tool_calls(response=response)
print(result)
```
</Step>
</Steps>
1 change: 1 addition & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"framework/langchain",
"framework/langgraph",
"framework/letta",
"framework/litellm",
"framework/llamaindex",
"framework/openai",
{
Expand Down
2 changes: 1 addition & 1 deletion js/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export default [
]
},
},
];
];
Loading
Loading