langchain/langchain
Kyle Roth c7db9febb0
count tokens for new OpenAI model versions (#6195)
Trying to call `ChatOpenAI.get_num_tokens_from_messages` returns the
following error for the newly announced models `gpt-3.5-turbo-0613` and
`gpt-4-0613`:

```
NotImplementedError: get_num_tokens_from_messages() is not presently implemented for model gpt-3.5-turbo-0613.See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens.
```

This adds support for counting tokens for those models, by counting
tokens the same way they're counted for the previous versions of
`gpt-3.5-turbo` and `gpt-4`.

#### reviewers

  - @hwchase17
  - @agola11
2023-06-15 06:16:03 -07:00
..
agents add functions agent (#6113) 2023-06-13 18:51:01 -07:00
callbacks Update Name (#6136) 2023-06-13 22:25:36 -07:00
chains Add support for tags (#5898) 2023-06-13 12:30:59 -07:00
chat_models count tokens for new OpenAI model versions (#6195) 2023-06-15 06:16:03 -07:00
client Return session name in runner response (#6112) 2023-06-13 16:59:43 -07:00
docstore changed ValueError to ImportError (#5006) 2023-05-19 15:28:08 -07:00
document_loaders feat: add content_format param to ConfluenceLoader.load() (#5922) 2023-06-14 16:56:28 -07:00
embeddings Add embaas document extraction api endpoints (#6048) 2023-06-12 19:13:52 -07:00
evaluation Update run eval imports in init (#5858) 2023-06-08 10:44:36 -07:00
experimental Return session name in runner response (#6112) 2023-06-13 16:59:43 -07:00
graphs Add additional parameters to Graph Cypher Chain (#5979) 2023-06-10 14:39:55 -07:00
indexes Create async copy of from_text() inside GraphIndexCreator. (#5214) 2023-05-24 21:54:12 -07:00
llms nc/load (#5733) 2023-06-11 15:51:28 -07:00
load turn off repr (#6078) 2023-06-12 22:45:24 -07:00
memory Add support for the endpoint URL in DynamoDBChatMesasgeHistory (#5836) 2023-06-08 23:21:11 -07:00
output_parsers added support for different types in ResponseSchema class (#5789) 2023-06-06 22:00:48 -07:00
prompts nc/load (#5733) 2023-06-11 15:51:28 -07:00
retrievers I before E (#6015) 2023-06-11 15:45:12 -07:00
tools convert tools to openai (#6100) 2023-06-13 10:40:49 -07:00
utilities Fix the issue where the parameters passed to VertexAI ignored #5889 (#5891) 2023-06-08 23:15:22 -07:00
vectorstores Implement max_marginal_relevance_search in VectorStore of Pinecone (#6056) 2023-06-13 10:46:45 -07:00
__init__.py console callback verbose (#4696) 2023-05-17 01:28:43 +00:00
base_language.py nc/load (#5733) 2023-06-11 15:51:28 -07:00
cache.py feat: add Momento as a standard cache and chat message history provider (#5221) 2023-05-25 19:13:21 -07:00
docker-compose.yaml Update docker-compose.yaml (#3582) 2023-04-26 15:11:59 -07:00
document_transformers.py Contextual compression retriever (#2915) 2023-04-20 17:01:14 -07:00
env.py Use LCP Client in Tracer (#5908) 2023-06-08 21:15:14 -07:00
example_generator.py Replace remaining usage of basellm with baselangmodel (#3981) 2023-05-02 21:52:29 -07:00
formatting.py Validate input_variables when using jinja2 templates (#3140) 2023-04-19 16:18:32 -07:00
input.py FileCallbackHandler (#5589) 2023-06-03 16:48:48 -07:00
math_utils.py add get_top_k_cosine_similarity method to get max top k score and index (#5059) 2023-05-22 11:55:48 -07:00
model_laboratory.py Harrison/improve cache (#368) 2022-12-18 16:22:42 -05:00
py.typed Add py.typed marker to package (#121) 2022-11-12 11:22:32 -08:00
python.py Move PythonRepl -> langchain.utilities (#2917) 2023-04-15 10:50:25 -07:00
requests.py fixed aiohttp.client_exceptions.ClientConnectionError: Connection closed (#2718) 2023-04-11 10:52:55 -07:00
schema.py add functions agent (#6113) 2023-06-13 18:51:01 -07:00
serpapi.py move serpapi wrapper (#1199) 2023-02-20 21:15:45 -08:00
server.py Fix for ModuleNotFoundError while running langchain-server. Issue #5833 (#6077) 2023-06-13 08:37:07 -07:00
sql_database.py Revise DATABRICKS_API_TOKEN as DATABRICKS_TOKEN (#5796) 2023-06-06 14:22:49 -07:00
text_splitter.py feat: Add support for the Solidity language (#6054) 2023-06-14 14:25:02 -07:00
utils.py feat(integrations): Add WandbTracer (#4521) 2023-06-01 00:01:19 -07:00