-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2666da
commit 306b8f8
Showing
12 changed files
with
51 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
composio_langchain===0.1.58 | ||
composio_langchain===0.1.59 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
from composio_langchain import ComposioToolset | ||
import json | ||
from typing import Sequence, List | ||
from flask import Flask, request | ||
from crewai import Agent, Task | ||
from composio_crewai import ComposioToolset, App, Action | ||
from langchain_openai import ChatOpenAI | ||
|
||
from llama_index.llms.openai import OpenAI | ||
from llama_index.core.llms import ChatMessage | ||
from llama_index.core.tools import BaseTool, FunctionTool | ||
app = Flask(__name__) | ||
|
||
import nest_asyncio | ||
llm = ChatOpenAI(openai_api_key="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", model="gpt-4-0613") | ||
|
||
nest_asyncio.apply() | ||
class GithubLinearTodoAgent(): | ||
|
||
def __init__(self): | ||
self.composioCrewAI = ComposioToolset([App.GITHUB, App.LINEAR]) | ||
|
||
def createAgent(self): | ||
return Agent( | ||
role='Github-Linear TODO Agent', | ||
goal="""Take action on Linear via Linear APIs based on Github commits. Linear Project to create issues: Hermes""", | ||
backstory="""You are an AI Agent with access to Github and Linear and wants to keep the Github Code TODOs and Linear in Sync. Linear Project to create issues: Hermes""", | ||
verbose=True, | ||
tools=self.composioCrewAI, | ||
llm=llm | ||
) | ||
|
||
def task(self, payload): | ||
return Task(description=f"""Given the following Github patch: {payload}, create a Linears issues for the TODOs | ||
in the patch and assign them to right people. Please read the patch carefully and create issues for the new TODOs only, avoid removed/old TODOs.""", | ||
expected_output="A LINEAR issue created for the commit", | ||
agent=self.createAgent(), | ||
) | ||
|
||
@app.route('/webhook', methods=['POST']) | ||
def webhook(): | ||
agent = GithubLinearTodoAgent() | ||
agent.task( | ||
request.json | ||
).execute() | ||
return 'Payload received and processed', 200 | ||
|
||
if __name__ == '__main__': | ||
app.run(port=2000, debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters