#Finished chain output empty

1 messages · Page 1 of 1 (latest)

opal fog
#

When I was testing how the ConversationBufferMemory() works in VSCode, I noticed I didn't get any output from the >Finished chain when I wasn't specifying any models in the llm variable, but when I did specify 'gpt-3.5-turbo' I got the following error
"This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}"

This is the code that I have written without specifying the llm model:

import os
from apikey import apikey

from langchain_openai import OpenAI

from langchain.chains.conversation.memory import ConversationBufferMemory
from langchain.chains import ConversationChain

os.environ['OPENAI_API_KEY'] = apikey
llm = OpenAI(
model="davinci-002",
temperature=0.9)

memory = ConversationBufferMemory()
conversation = ConversationChain(
llm=llm,
verbose=True,
memory=memory
)

conversation.predict(input="Hi, how are you?")

Any idea why I'm not getting any output from the

Finished Chain?

solemn bladeBOT
#

Hi @opal fog. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems like you're trying to use the davinci-002 model with the ConversationChain from the langchain library. However, the error message suggests that you're trying to use a chat model with the v1/completions endpoint, which is not supported.

The gpt-3.5-turbo model, which is a chat model, should be used with the v1/chat/completions endpoint as shown in the OpenAI API documentation (https://platform.openai.com/docs/quickstart). Here's the example code from the documentation:

from openai import OpenAI
client = OpenAI()

completion = client.chat.completions.create(
 model="gpt-3.5-turbo",
 messages=[
 {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
 {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
 ]
)

print(completion.choices[0].message)

To run the code, enter python openai-test.py into the terminal / command line.

If you're not getting any output from the Finished Chain, it could be due to a variety of reasons such as incorrect configuration, issues with the model, or problems with the input. Without more specific information, it's hard to provide a definitive answer.

If you're using the langchain library, you might want to check the documentation (https://python.langchain.com/docs/modules/chains/how_to/openai_functions) or ask for help in the OpenAI community forum (https://community.openai.com).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@opal fog kapa.ai is still learning and improving, please let us know how it did by reacting below