PromptLayerOpenAI()Get the namespace of the langchain object.
Build extra kwargs from additional params that were passed in.
Validate environment.
Get the sub prompts for llm call.
Create the LLMResult from the choices and prompts.
Get the tokens present in the text with tiktoken package.
Calculate the maximum number of tokens possible to generate for a model.
Calculate the maximum number of tokens possible to generate for a prompt.
| Name | Type | Description |
|---|---|---|
``pl_tags``* | unknown | List of strings to tag the request with. |
``return_pl_id``* | unknown | If True, the PromptLayer request ID will be
returned in the |
PromptLayer OpenAI large language models.
To use, you should have the openai and promptlayer python
package installed, and the environment variable OPENAI_API_KEY
and PROMPTLAYER_API_KEY set with your openAI API key and
promptlayer key respectively.
All parameters that can be passed to the OpenAI LLM can also be passed here. The PromptLayerOpenAI LLM adds two optional
Example:
.. code-block:: python
from langchain_community.llms import PromptLayerOpenAI openai = PromptLayerOpenAI(model_name="gpt-3.5-turbo-instruct")