> ## Documentation Index
> Fetch the complete documentation index at: https://composio-27-feat-docs-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 🛠️ How can I use Tools with LLMs?

> Guide to using Tools with LLMs

### Using Tools with LLMs

Composio enables you to integrate various tools (such as Gmail, GitHub, and Salesforce) and perform actions (such as sending emails or creating GitHub issues). Browse our complete list of supported [Tools](https://app.composio.dev/apps).

Install packages:

<CodeGroup>
  ```bash Python
  pip install composio-openai openai
  ```

  ```bash JavaScript
  npm install composio-core openai
  ```
</CodeGroup>

Using tools with LLMs:

<CodeGroup>
  ```python Python
  # Import required libraries
  from composio_openai import ComposioToolSet, App
  from openai import OpenAI

  # Initialize OpenAI and Composio clients
  openai_client = OpenAI()
  composio_toolset = ComposioToolSet()

  # Get GitHub tools from Composio
  tools = composio_toolset.get_tools(apps=[App.GITHUB])

  task = "Star the repo composiohq/composio on GitHub"

  # Make API call to OpenAI with the tools
  response = openai_client.chat.completions.create(
      model="gpt-4o-mini",
      tools=tools,
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": task},
      ],
  )

  # Execute the tool calls
  result = composio_toolset.handle_tool_calls(response)
  print(result)
  ```

  ```javascript JavaScript
  // Import required libraries
  import { OpenAI } from "openai";
  import { OpenAIToolSet } from "composio-core";

  // Initialize OpenAI and Composio clients
  const openai_client = new OpenAI();
  const composio_toolset = new OpenAIToolSet();

  // Get GitHub tools from Composio
  const tools = await composio_toolset.getTools({
    actions: ["github_star_a_repository_for_the_authenticated_user"]
  });

  const task = "Star the repo composiohq/composio on GitHub";

  // Make API call to OpenAI with the tools
  const response = await openai_client.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: task }],
    tools: tools,
    tool_choice: "auto",
  });

  // Execute the tool calls
  const result = await composio_toolset.handleToolCall(response);
  console.log(result);
  ```
</CodeGroup>

This code demonstrates how to use LLMs with Composio Tools to execute actions. The example shows how to connect OpenAI's LLM with Composio's tools, in this case using the GitHub tool. The LLM understands the natural language task ("Star the repo") and determines which action to use from the GitHub tool, then executes the action.

### How can I use Tools for a specific user?

You can use the `entity_id` parameter to specify the user on behalf of whom you want to execute the action. Learn more about Entities [here](/patterns/Auth/connected_account#entities).

Install packages:

<CodeGroup>
  ```bash Python
  pip install composio-openai openai
  ```

  ```bash JavaScript
  npm install composio-core openai
  ```
</CodeGroup>

Using tools for a specific user:

<CodeGroup>
  ```python Python {7}
  # Import required libraries
  from composio_openai import ComposioToolSet, App
  from openai import OpenAI

  # Initialize OpenAI and Composio clients
  openai_client = OpenAI()
  composio_toolset = ComposioToolSet(entity_id="Jessica")

  # Get GitHub tools from Composio for the entity Jessica
  tools = composio_toolset.get_tools(apps=[App.GITHUB])

  task = "Star the repo composiohq/composio on GitHub"

  # Make API call to OpenAI with the tools
  response = openai_client.chat.completions.create(
      model="gpt-4o-mini",
      tools=tools,
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": task},
      ],
  )

  # Execute the tool calls
  result = composio_toolset.handle_tool_calls(response=response)
  print(result)
  ```

  ```javascript JavaScript {10}
  // Import required libraries
  import { OpenAI } from "openai";
  import { OpenAIToolSet } from "composio-core";

  // Initialize OpenAI and Composio clients
  const openai_client = new OpenAI();
  const composio_toolset = new OpenAIToolSet();

  // Get GitHub tools from Composio
  const tools = await composio_toolset.getTools({apps: ['GITHUB'], entityId: "Jessica"})

  const task = "Star the repo composiohq/composio on GitHub"

  // Make API call to OpenAI with the tools
  const response = await openai_client.chat.completions.create({
      model: "gpt-4o-mini",
      messages: [{ role: "user", content: task }],
      tools: tools,
      tool_choice: "auto",
  });

  const result = await composio_toolset.handleToolCall(response);
  console.log(result);
  ```
</CodeGroup>

Composio supports multiple agent frameworks including LlamaIndex, CrewAI, Letta, and LangChain. See the [**Supported Frameworks**](../../../framework) section for details.
