Home / File/ server.py — langchain Source File

server.py — langchain Source File

Architecture documentation for server.py, a python file in the langchain codebase. 8 imports, 0 dependents.

File python LangChainCore Runnables 8 imports 8 functions 7 classes

Entity Profile

Dependency Diagram

graph LR
  91e9eb65_99fe_4463_ea22_add75adcc13a["server.py"]
  7ec08df6_88bd_07ab_d50f_0d4c4e429b7e["enum"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> 7ec08df6_88bd_07ab_d50f_0d4c4e429b7e
  feec1ec4_6917_867b_d228_b134d0ff8099["typing"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> feec1ec4_6917_867b_d228_b134d0ff8099
  02f66451_d2a9_e7c3_9765_c3a7594721ad["uuid"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> 02f66451_d2a9_e7c3_9765_c3a7594721ad
  7843d658_88dd_4a43_129c_85d09ed835f5["uvicorn"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> 7843d658_88dd_4a43_129c_85d09ed835f5
  b8ad0534_a884_8574_58ef_0b30d8c9a027["fastapi"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> b8ad0534_a884_8574_58ef_0b30d8c9a027
  ab946b8d_d9a6_3a22_b8f9_30fc23ad540c["fastapi.middleware.cors"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> ab946b8d_d9a6_3a22_b8f9_30fc23ad540c
  616cb122_6df1_945e_9ae4_07a218add8d4["fastapi.openapi.utils"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> 616cb122_6df1_945e_9ae4_07a218add8d4
  dd5e7909_a646_84f1_497b_cae69735550e["pydantic"]
  91e9eb65_99fe_4463_ea22_add75adcc13a --> dd5e7909_a646_84f1_497b_cae69735550e
  style 91e9eb65_99fe_4463_ea22_add75adcc13a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""A mock Robot server."""

from enum import Enum
from typing import Annotated, Any
from uuid import uuid4

import uvicorn
from fastapi import FastAPI, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware
from fastapi.openapi.utils import get_openapi
from pydantic import BaseModel, Field

PORT = 7289

app = FastAPI()
origins = [
    "http://localhost",
    "http://localhost:8000",
    "http://127.0.0.1",
    "http://127.0.0.1:8000",
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)
PASS_PHRASE = str(uuid4())

_ROBOT_LOCATION = {"x": 0, "y": 0, "z": 0}


class StateItems(str, Enum):
    location = "location"
    walking = "walking"
    speed = "speed"
    direction = "direction"
    style = "style"
    cautiousness = "cautiousness"
    jumping = "jumping"
    destruct = "destruct"


_ROBOT_STATE = {
    "location": _ROBOT_LOCATION,
    "walking": False,
    "speed": 0,
    "direction": "north",
    "style": "normal",
    "cautiousness": "medium",
    "jumping": False,
    "destruct": False,
}


class Direction(str, Enum):
    north = "north"
    south = "south"
// ... (147 more lines)

Domain

Subdomains

Dependencies

  • enum
  • fastapi
  • fastapi.middleware.cors
  • fastapi.openapi.utils
  • pydantic
  • typing
  • uuid
  • uvicorn

Frequently Asked Questions

What does server.py do?
server.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, Runnables subdomain.
What functions are defined in server.py?
server.py defines 8 function(s): ask_for_help, ask_for_passphrase, custom_openapi, get_state, goto, recycle, uvicorn, walk.
What does server.py depend on?
server.py imports 8 module(s): enum, fastapi, fastapi.middleware.cors, fastapi.openapi.utils, pydantic, typing, uuid, uvicorn.
Where is server.py in the architecture?
server.py is located at libs/langchain/tests/mock_servers/robot/server.py (domain: LangChainCore, subdomain: Runnables, directory: libs/langchain/tests/mock_servers/robot).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free