Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add contributing guide
Tomas Valenta00aab8d8464e
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 000000000..18ae9cf59--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,150 @@+# Contributing+If you want to contribute open a PR, issue, or start a discussion on our [Discord](https://discord.gg/dSBY3ms2Qr).++## Adding new models or new model hosting providers+1. Add model on **frontend**+ - Add model name to `enum ModelProvider` in [state/model.ts](state/model.ts)+ - Add model template to `const modelTemplates` in [state/model.ts](state/model.ts)+ > `creds` and `args` defined in the `modelTemplates` are accessible on backend in `get_model` under their exact names in `config["args"]` object.+ - Add model's PNG icon image to `public/`+ - Add a new model icon to `const iconPaths` and `const providerIcons` in [components/icons/ProviderIcon.tsx](components/icons/ProviderIcon.tsx)++2. Add model on **backend** in [api-service/models/base.py](api-service/models/base.py)+ - Add model name to enum `ModelProvider`+ - Add model integration (implementing langchain's `BaseLanguageModel`) to `def get_model`. You can often use the [langchain's](https://python.langchain.com/en/latest/modules/models/llms/integrations.html) integrations.+ > Sometimes we need to modify integrations provided by langchain (to ignore env vars, etc.). If you modify the integrations add them like [this](api-service/models/wrappers/replicate.py).++3. Test if the new model works by starting the app, configuring the model and trying to "Run" it. Add a screenshot of the results to the PR if you can.++### Example of adding a new model/model hosting provider++#### **Frontend**++[state/model.ts](state/model.ts)+```ts+export enum ModelProvider {+ ...+ NewModel = 'NewModel',+ ...+}++export const modelTemplates: {+ [provider in keyof typeof ModelProvider]?: ProviderTemplate+} = {+ ...+ [ModelProvider.NewModel]: {+ creds: {+ new_model_api_token: { // <---------------- this will be accessible as `config["args"]["new_model_api_token"]` on backend+ label: 'New Model API Key',+ type: 'string',+ },+ },+ models: [+ {+ name: '<Model name>',+ args: {+ temperature: { // <---------------- this will be accessible as `config["args"]["temperature"]` on backend+ label: 'Temperature',+ editable: true,+ type: 'number',+ value: 0.4,+ min: 0.01,+ max: 1,+ step: 0.01,+ },+ },+ },+ ],+ },+ ...+}+```++[components/icons/ProviderIcon.tsx](components/icons/ProviderIcon.tsx)+```ts+const iconPaths: {+ [provider in keyof typeof ModelProvider]: string+} = {+ ...+ [ModelProvider.HuggingFace]: '/new-model.png',+ ...+}++export const providerIcons: {+ [provider in keyof typeof ModelProvider]: ReactNode+} = {+ ...+ [ModelProvider.NewModel]: <ProviderIcon provider={ModelProvider.NewModel} />,+ ...+}+```++#### **Backend**+[api-service/models/base.py](api-service/models/base.py)+```py+class ModelProvider(Enum):+ ...+ NewModel = "NewModel"+ ...++def get_model(+ config: ModelConfig,+ callback_manager: BaseCallbackManager,+) -> BaseLanguageModel:+ match config["provider"]:+ ...+ case ModelProvider.NewModel.value:+ return NewModelIntegration( # <---------------- class implementing `BaseLanguageModel`+ **config["args"], # <---------------- args passed from frontend+ verbose=True,+ streaming=True,+ callback_manager=callback_manager,+ )+ ...+```++## π» Development+For developing with hot reloading and contributing to the project you may want to run the app locally without Docker Compose (`npm start` command). Here are the steps for how to do it.++You will need:+- OpenAI API key (support for more and custom models coming soon)+- Docker+- Node.js *16+*+- Python *3.10+*+- Poetry *1.3.2+*+- Free ports 3000, 49155, 49160, 54321, 54322++### 1. Install dependencies+```+npm run install:all+```++### 2. Start local Supabase+```+npm run db:start+```++> Local Supabase runs in the background - to stop it you have to run `npm run db:stop`.++### 3. Add env vars+Create `.env` file by copying the [`.env.example`](.env.example)+```+cp .env.example .env+```+and fill in the following variables:+- `SUPABASE_SERVICE_ROLE_KEY` - Supabase service role key you got in the previous step as `service_role key: eyJh......`+- `NEXT_PUBLIC_SUPABASE_ANON_KEY` - Supabase anonymous key you got in the previous step as `anon key: eyJh......`++### 4. Start the app+```+npm run dev+```+Then open the page on [http://localhost:3000](http://localhost:3000) and sign in with the testing credentials:++**Email**+++**Password**+diff --git a/README.md b/README.mdindex ed2c2ac9b..392483cd1 100644--- a/README.md+++ b/README.md@@ -46,7 +46,7 @@ Then open the page on [http://localhost:3000](http://localhost:3000).> `npm start` starts local Supabase in the background - to stop it you have to run `npm run stop`.-> If you want to run the project without using containers use the [steps here](#development). This is useful if you want to leverage hot reloading and develop the project.+> If you want to run the project without using containers use the [steps here](./CONTRIBUTING.md#development). This is useful if you want to leverage hot reloading and develop the project.# Features@@ -71,14 +71,15 @@ We think the AI-powered IDE for the future should be open-sourced and allow anyb### **Model you like isn't supported?**-π Please open the ["New model request" issue](https://github.com/e2b-dev/e2b/issues/new?assignees=&labels=new+model+request&template=new-model-request.md&title=). π+π Please open the ["New model request" issue](https://github.com/e2b-dev/e2b/issues/new?assignees=&labels=new+model+request&template=new-model-request.md&title=) π-### π Early demos+π Or open a PR and [start contributing](./CONTRIBUTING.md#adding-new-models-or-new-model-hosting-providers) π++## π Early demos- [AI Agent using coding tools](https://twitter.com/mlejva/status/1636103084802822151)- [Build your custom "Just-In-Time" UI](https://twitter.com/mlejva/status/1641151421830529042)- [Agent coded a full Stripe customer checkout by following a technical spec provided by user](https://twitter.com/mlejva/status/1641072535163875330)-# βΉοΈ Community & Support- [Discord](https://discord.gg/U7KEcGErtQ) - live discussion and support- [GitHub issues](https://github.com/e2b-dev/e2b/issues) - for reporting bugs@@ -94,50 +95,3 @@ We think the AI-powered IDE for the future should be open-sourced and allow anyb6. Let users edit prompt7. Let users customize tools and build custom workflows for the agent8. Release cloud version---# π» Development-For developing with hot reloading and contributing to the project you may want to run the app locally without Docker Compose (`npm start` command). Here are the steps for how to do it.--You will need:-- OpenAI API key (support for more and custom models coming soon)-- Docker-- Node.js *16+*-- Python *3.10+*-- Poetry *1.3.2+*-- Free ports 3000, 49155, 49160, 54321, 54322--## 1. Install dependencies-```-npm run install:all-```--## 2. Start local Supabase-```-npm run db:start-```--> Local Supabase runs in the background - to stop it you have to run `npm run db:stop`.--## 3. Add env vars-Create `.env` file by copying the [`.env.example`](.env.example)-```-cp .env.example .env-```-and fill in the following variables:-- `SUPABASE_SERVICE_ROLE_KEY` - Supabase service role key you got in the previous step as `service_role key: eyJh......`-- `NEXT_PUBLIC_SUPABASE_ANON_KEY` - Supabase anonymous key you got in the previous step as `anon key: eyJh......`--## 4. Start the app-```-npm run dev-```-Then open the page on [http://localhost:3000](http://localhost:3000) and sign in with the testing credentials:--**Email**---**Password**-