feat: add agents
This commit is contained in:
parent
bdbeb4d4cf
commit
cb63404b50
6
.env.example
Normal file
6
.env.example
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Trytond version server: 7.0, 7.4
|
||||||
|
TRYTOND_VERSION=7.4
|
||||||
|
|
||||||
|
API_TOKEN_BOT="7060..."
|
||||||
|
OPENAI_API_KEY="sk-..."
|
||||||
|
TAVILY_API_KEY="tvly-..."
|
1
agents/.gitignore
vendored
Normal file
1
agents/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
__pycache__
|
21
agents/Dockerfile
Normal file
21
agents/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
RUN pip install poetry==1.6.1
|
||||||
|
|
||||||
|
RUN poetry config virtualenvs.create false
|
||||||
|
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
COPY ./pyproject.toml ./README.md ./poetry.lock* ./
|
||||||
|
|
||||||
|
COPY ./package[s] ./packages
|
||||||
|
|
||||||
|
RUN poetry install --no-interaction --no-ansi --no-root
|
||||||
|
|
||||||
|
COPY ./app ./app
|
||||||
|
|
||||||
|
RUN poetry install --no-interaction --no-ansi
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD exec uvicorn app.server:app --host 0.0.0.0 --port 8080
|
79
agents/README.md
Normal file
79
agents/README.md
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# agents
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install the LangChain CLI if you haven't yet
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -U langchain-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# adding packages from
|
||||||
|
# https://github.com/langchain-ai/langchain/tree/master/templates
|
||||||
|
langchain app add $PROJECT_NAME
|
||||||
|
|
||||||
|
# adding custom GitHub repo packages
|
||||||
|
langchain app add --repo $OWNER/$REPO
|
||||||
|
# or with whole git string (supports other git providers):
|
||||||
|
# langchain app add git+https://github.com/hwchase17/chain-of-verification
|
||||||
|
|
||||||
|
# with a custom api mount point (defaults to `/{package_name}`)
|
||||||
|
langchain app add $PROJECT_NAME --api_path=/my/custom/path/rag
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: you remove packages by their api path
|
||||||
|
|
||||||
|
```bash
|
||||||
|
langchain app remove my/custom/path/rag
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup LangSmith (Optional)
|
||||||
|
LangSmith will help us trace, monitor and debug LangChain applications.
|
||||||
|
You can sign up for LangSmith [here](https://smith.langchain.com/).
|
||||||
|
If you don't have access, you can skip this section
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export LANGCHAIN_TRACING_V2=true
|
||||||
|
export LANGCHAIN_API_KEY=<your-api-key>
|
||||||
|
export LANGCHAIN_PROJECT=<your-project> # if not specified, defaults to "default"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Launch LangServe
|
||||||
|
|
||||||
|
```bash
|
||||||
|
langchain serve
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running in Docker
|
||||||
|
|
||||||
|
This project folder includes a Dockerfile that allows you to easily build and host your LangServe app.
|
||||||
|
|
||||||
|
### Building the Image
|
||||||
|
|
||||||
|
To build the image, you simply:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker build . -t my-langserve-app
|
||||||
|
```
|
||||||
|
|
||||||
|
If you tag your image with something other than `my-langserve-app`,
|
||||||
|
note it for use in the next step.
|
||||||
|
|
||||||
|
### Running the Image Locally
|
||||||
|
|
||||||
|
To run the image, you'll need to include any environment variables
|
||||||
|
necessary for your application.
|
||||||
|
|
||||||
|
In the below example, we inject the `OPENAI_API_KEY` environment
|
||||||
|
variable with the value set in my local environment
|
||||||
|
(`$OPENAI_API_KEY`)
|
||||||
|
|
||||||
|
We also expose port 8080 with the `-p 8080:8080` option.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8080:8080 my-langserve-app
|
||||||
|
```
|
0
agents/packages/README.md
Normal file
0
agents/packages/README.md
Normal file
3115
agents/poetry.lock
generated
Normal file
3115
agents/poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
agents/pyproject.toml
Normal file
35
agents/pyproject.toml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "agents"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = ""
|
||||||
|
authors = ["Your Name <you@example.com>"]
|
||||||
|
readme = "README.md"
|
||||||
|
packages = [
|
||||||
|
{ include = "app" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.11"
|
||||||
|
uvicorn = "0.34.0"
|
||||||
|
langserve = {extras = ["server"], version = ">=0.0.30"}
|
||||||
|
pydantic = "2.10.4"
|
||||||
|
httpx = "0.28.1"
|
||||||
|
langchain = "0.3.13"
|
||||||
|
langgraph = "0.2.60"
|
||||||
|
langchain-core = ">=0.3.28,<0.4.0"
|
||||||
|
pytest = "^8.3.4"
|
||||||
|
python-dotenv = "1.0.1"
|
||||||
|
requests = "2.32.3"
|
||||||
|
pandas = "^2.1.4"
|
||||||
|
openpyxl = "^3.1.2"
|
||||||
|
pyyaml = "6.0.2"
|
||||||
|
langchain-openai = "0.3.6"
|
||||||
|
fastapi = "0.115.6"
|
||||||
|
streamlit = "1.41.0"
|
||||||
|
|
||||||
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
langchain-cli = ">=0.0.15"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
27
agents/test_create_party.py
Normal file
27
agents/test_create_party.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from app.langgraph_tools.tools.orders.order_tools_2 import create_party
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Prueba de la función create_party
|
||||||
|
def test_create_party():
|
||||||
|
# Parámetros de ejemplo
|
||||||
|
party_full_name = "Cristian Garces"
|
||||||
|
contact_method_type = "email"
|
||||||
|
contact_method_value = "cristian.garces@example.com"
|
||||||
|
|
||||||
|
# Llamar a la función
|
||||||
|
response = create_party(
|
||||||
|
party_full_name=party_full_name,
|
||||||
|
contact_method_type=contact_method_type,
|
||||||
|
contact_method_value=contact_method_value
|
||||||
|
)
|
||||||
|
|
||||||
|
# Imprimir la respuesta
|
||||||
|
print("Status Code:", response.status_code)
|
||||||
|
try:
|
||||||
|
print("Response:", json.loads(response.text))
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
print("Raw Response:", response.text)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_create_party()
|
@ -1,4 +1,3 @@
|
|||||||
version: '3.9'
|
|
||||||
services:
|
services:
|
||||||
app.dev:
|
app.dev:
|
||||||
build:
|
build:
|
||||||
@ -6,11 +5,6 @@ services:
|
|||||||
dockerfile: Dockerfile_Test
|
dockerfile: Dockerfile_Test
|
||||||
args:
|
args:
|
||||||
TRYTOND_VERSION: ${TRYTOND_VERSION}
|
TRYTOND_VERSION: ${TRYTOND_VERSION}
|
||||||
GITEA_USER: ${GITEA_USER}
|
|
||||||
GITEA_PASSWORD: ${GITEA_PASSWORD}
|
|
||||||
GITEA_DOMAIN: ${GITEA_DOMAIN}
|
|
||||||
FACHO: ${FACHO}
|
|
||||||
FACHO_BRANCH: ${FACHO_BRANCH}
|
|
||||||
environment:
|
environment:
|
||||||
SRC: /app
|
SRC: /app
|
||||||
DB_CACHE: /tmp
|
DB_CACHE: /tmp
|
||||||
|
26
compose.yml
26
compose.yml
@ -1,4 +1,3 @@
|
|||||||
version: '3.9'
|
|
||||||
services:
|
services:
|
||||||
db.dev:
|
db.dev:
|
||||||
image: postgres:12
|
image: postgres:12
|
||||||
@ -11,11 +10,6 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
TRYTOND_VERSION: ${TRYTOND_VERSION}
|
TRYTOND_VERSION: ${TRYTOND_VERSION}
|
||||||
GITEA_USER: ${GITEA_USER}
|
|
||||||
GITEA_PASSWORD: ${GITEA_PASSWORD}
|
|
||||||
GITEA_DOMAIN: ${GITEA_DOMAIN}
|
|
||||||
FACHO: ${FACHO}
|
|
||||||
FACHO_BRANCH: ${FACHO_BRANCH}
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db.dev
|
- db.dev
|
||||||
command: bash .dev/run.sh
|
command: bash .dev/run.sh
|
||||||
@ -30,3 +24,23 @@ services:
|
|||||||
working_dir: /app
|
working_dir: /app
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
agents.dev:
|
||||||
|
build:
|
||||||
|
context: ./agents
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
API_TOKEN_BOT: ${API_TOKEN_BOT}
|
||||||
|
OPENAI_API_KEY: ${OPENAI_API_KEY}
|
||||||
|
TAVILY_API_KEY: ${TAVILY_API_KEY}
|
||||||
|
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
- "8501:8501"
|
||||||
|
volumes:
|
||||||
|
- ./agents:/code
|
||||||
|
environment:
|
||||||
|
- PYTHONUNBUFFERED=1
|
||||||
|
command: >
|
||||||
|
uvicorn app.server:app --host 0.0.0.0 --port 8080
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
Loading…
Reference in New Issue
Block a user