Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom model is not working in langsmith playground #1490

Open
muhammedhishamc opened this issue Feb 5, 2025 · 1 comment
Open

Custom model is not working in langsmith playground #1490

muhammedhishamc opened this issue Feb 5, 2025 · 1 comment

Comments

@muhammedhishamc
Copy link

muhammedhishamc commented Feb 5, 2025

I setup the langserve with custom model and the server is working fine. but the langsmith playground is not sending request to the local server

code in local server:

from fastapi import FastAPI
from langchain_openai import ChatOpenAI
from langserve import add_routes
import os
from fastapi.middleware.cors import CORSMiddleware
import uvicorn

client = ChatOpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key=os.environ['LLM_API_KEY'],
    model="openai/gpt-4o-mini",
).configurable_fields()

app = FastAPI(
    title="LangChain Server",
    version="1.0",
    description="A simple api server using Langchain's Runnable interfaces",
)
add_routes(
    app,
    client,
    path="/openai",
)

# Set all CORS enabled origins
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
    expose_headers=["*"],
)

if _name_ == "_main_":
    uvicorn.run(app, host="0.0.0.0", port=8000)

Image

Image

Idea or request for content:

No response

@langchain-infra
Copy link
Contributor

Hi @muhammedhishamc , you will need to host this to an external URL as our playground service has no way to reach your model server today. We do not send requests to the custom model directly from the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants