Why am I Encountering an Error When Using the OpenAI Package in a Python Step?

This topic was automatically generated from Slack. You can find the original thread here.

Hi When I try to use the openai package in a python step, I get the following error “Could not import openai python package. Please install it with pip install openai

I apologize for the confusion. In Pipedream Python steps, you can use the requests package to make API calls. The openai package is not available in Pipedream Python steps. You can make API calls to OpenAI using the requests package. Here’s an example of how to import requests in a Python step: import requests For more information on using requests in Pipedream Python steps, please refer to the documentation: Making an HTTP request

I’m trying to use langchain and openai is a dependency. e.g.

import os
from langchain.chains.conversation.memory import ConversationBufferMemory
from langchain import OpenAI, LLMChain, PromptTemplate

The built-in OpenAI integration is fine for simple tasks but is missing several key features
• the ability to provide a system prompt,
• the ability to select the model (e.g. gpt-3.5-turbo vs gpt-3.5-turbo-16k vs gpt4 )
I’m using langchain as a straightforward way to keep a session alive and continue to make prompts (not supported in the native openai api)

This is a good explanation of what I’m talking about https://stackoverflow.com/questions/74711107/openai-api-continuing-conversation-in-a-dialogue/75743981#75743981