Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Beautify JSON docs (#906)

Deven Patel54287653298e
diff --git a/docs/data-sources/json.mdx b/docs/data-sources/json.mdx
index 5f2430706..d4821638b 100644
--- a/docs/data-sources/json.mdx
+++ b/docs/data-sources/json.mdx
@@ -12,7 +12,7 @@ Here are the supported sources for loading `json`:
```
If you would like to add other data structures (e.x. list, dict etc.), do:
-```
+```python
import json
a = {"foo": "bar"}
valid_json_string_data = json.dumps(a, indent=0)
@@ -21,7 +21,7 @@ If you would like to add other data structures (e.x. list, dict etc.), do:
valid_json_string_data = json.dumps(b, indent=0)
```
Example:
-```
+```python
import os
from embedchain.apps.app import App
@@ -43,7 +43,7 @@ print(response)
"As of October 2023, Elon Musk's net worth is $255.2 billion."
```
temp.json
-```
+```json
{
"question": "What is your net worth, Elon Musk?",
"answer": "As of October 2023, Elon Musk's net worth is $255.2 billion, making him one of the wealthiest individuals in the world."
diff --git a/examples/rest-api/main.py b/examples/rest-api/main.py
index 70bb87fba..9b2341044 100644
--- a/examples/rest-api/main.py
+++ b/examples/rest-api/main.py
@@ -1,19 +1,16 @@
-import os
import logging
+import os
+
import yaml
-from fastapi import FastAPI, UploadFile, Depends, HTTPException
+from database import Base, SessionLocal, engine
+from fastapi import Depends, FastAPI, HTTPException, UploadFile
+from models import DefaultResponse, DeployAppRequest, QueryApp, SourceApp
+from services import get_app, get_apps, remove_app, save_app
from sqlalchemy.orm import Session
+from utils import generate_error_message_for_api_keys
+
from embedchain import Pipeline as App
from embedchain.client import Client
-from models import (
- QueryApp,
- SourceApp,
- DefaultResponse,
- DeployAppRequest,
-)
-from database import Base, engine, SessionLocal
-from services import get_app, save_app, get_apps, remove_app
-from utils import generate_error_message_for_api_keys
Base.metadata.create_all(bind=engine)
diff --git a/examples/rest-api/models.py b/examples/rest-api/models.py
index 7a359852d..1aecf00aa 100644
--- a/examples/rest-api/models.py
+++ b/examples/rest-api/models.py
@@ -1,7 +1,8 @@
from typing import Optional
-from pydantic import BaseModel, Field
-from sqlalchemy import Column, String, Integer
+
from database import Base
+from pydantic import BaseModel, Field
+from sqlalchemy import Column, Integer, String
class QueryApp(BaseModel):
diff --git a/examples/rest-api/services.py b/examples/rest-api/services.py
index af2c984b0..c200454b8 100644
--- a/examples/rest-api/services.py
+++ b/examples/rest-api/services.py
@@ -1,6 +1,5 @@
-from sqlalchemy.orm import Session
-
from models import AppModel
+from sqlalchemy.orm import Session
def get_app(db: Session, app_id: str):