Skip to content

Does LangServe Currently Support OpenAIAssistantRunnable using add_routes? #456

Answered by eyurtsev
JWShroyer asked this question in Q&A
Discussion options

You must be logged in to vote

Here's an example with an agent executor:

from fastapi import FastAPI
from langchain.agents import AgentExecutor
from langchain.agents.openai_assistant import OpenAIAssistantRunnable
from langchain.tools import tool
from typing_extensions import TypedDict

from langserve import add_routes

app = FastAPI(
    title="Title",
    description="a description",
    version="0.1.0",
    summary="This is a summary of this app",
)


@tool
def favorite_animal(name: str) -> str:
    """Get the favorite animal of the person with the given name"""
    if name.lower().strip() == "eugene":
        return "cat"
    return "dog"


tools = [favorite_animal]

runnable = OpenAIAssistantRunnable.create_assistant

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@JWShroyer
Comment options

@Ghat0tkach
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@yumistudio
Comment options

@dentroai
Comment options

Answer selected by eyurtsev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants