Repository: truera/trulens
Issue: LangChain LCEL support
Root cause: Unimplemented Feature Gap

I tried to replicate the langchain example with LCEL the following way:

```python 
tru = Tru()

fopenai = TruLensOpenAI()
llm = AzureChatOpenAI(model_name="gpt-3.5-turbo")

full_prompt = HumanMessagePromptTemplate(
    prompt=PromptTemplate(
        template="Provide a helpful response with relevant background information for the following: {prompt}",
        input_variables=["prompt"],
    )
)
chat_prompt_template = ChatPromptTemplate.from_messages([full_prompt])

chain = chat_prompt_template | llm | StrOutputParser()
harmfulness = Feedback(fopenai.harmfulness).on_input()
tru_recorder = TruChain(chain,
    app_id='Chain1_ChatApplication',
    feedbacks=[harmfulness])
prompt_input = '¿que hora es?'
llm_response = tru_recorder(prompt_input)
```

but get the following error: 

`  Can't instantiate abstract class Chain with abstract methods _call, input_keys, output_keys (type=type_error)`

would love to use this library but this is a blocker.

Looking into support for LCEL @Wildhammer  - thanks!

Appreciate you folks prioritizing this. I know lots of people are switching to LCEL as it is the direction LangChain is taking

LCEL is the preferred production implementation for LangChain, so integration with LCEL is a must for us...

Thanks for your earliest attention to this matter!

Hi; can you share how to run this app without trulens_eval? I'm having trouble completing the app so I can test trulens_eval with it.

I've had success with these expression language apps by following the example at https://python.langchain.com/docs/expression_language/cookbook/multiple_chains and instrumenting the relevant methods like in this code below:

```python
from trulens_eval import TruChain, Tru
tru = Tru()

from langchain_core.runnables.base import RunnableSerializable
from trulens_eval.instruments import instrument
instrument.method(RunnableSerializable, "invoke")
instrument.method(RunnableSerializable, "ainvoke")

from operator import itemgetter
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema import StrOutputParser

prompt1 = ChatPromptTemplate.from_template("what is the city {person} is from?")
prompt2 = ChatPromptTemplate.from_template(
    "what country is the city {city} in? respond in {language}"
)

model = ChatOpenAI()

chain1 = prompt1 | model | StrOutputParser()

chain2 = (
    {"city": chain1, "language": itemgetter("language")}
    | prompt2
    | model
    | StrOutputParser()
)

chain2_input = {"person": "obama", "language": "spanish"}

chain2.invoke(chain2_input)

tru_recorder = TruChain(
    chain2,
    app_id='Chain2'
)

with tru_recorder as recs:
    llm_response = chain2.invoke({"person": "obama", "language": "spanish"})
```

We will work on automatically instrumenting these methods for future releases but for now you can make sure they get instrumented by using the `instrument.method` calls as in the example above.

Hey @Wildhammer @pjbhaumik - check out https://github.com/truera/trulens/pull/691 for added LCEL support + an example of usage.

Posting back @Wildhammer @pjbhaumik  - this is released in trulens_eval==0.19.2!