Skip to content

Commit

Permalink
Document conversations properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rizerphe committed Jul 3, 2023
1 parent 89fb006 commit cee0ea0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions docs/conversation.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,26 @@ The arguments passed to `add_function` are the same as those an [OpenAIFunction]
- `interpret_as_response` - whether to interpret the return value of the function (the serialized one if `serialize` is set to True) as the response from the AI, replacing the function call

You can read more about how to use skills [here](skills).

## Generating messages

The point of a conversation is to use the AI to generate responses. The easiest way to do this is through the `ask` method:

```python
response = conversation.ask("Your input data")
```

The tool will then repeatedly get responses from OpenAI and run your functions until a full response is generated. Alternatively, if you don't want to add another message to the conversation, you can use the `run_until_response` method that returns a [FinalResponseMessage](openai_functions.FinalResponseMessage) object:

```python
generated_message = conversation.run_until_response()
further_comment = conversation.run_until_response(allow_function_calls=False)
```

If you want to use the conversation to run a specific function more directly and get the execution result, you can use the `run` method, optionally also providing another message:

```python
raw_weather_result = conversation.run("get_weather", "What's the weather in San Francisco?")
```

However, for most usecases [@nlp](nlp_interface) should be sufficient; consider using it.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openai-functions"
version = "0.6.4"
version = "0.6.5"
description = "Simplifies the usage of OpenAI ChatGPT's function calling by generating the schemas and parsing OpenAI's responses for you."
authors = ["rizerphe <44440399+rizerphe@users.noreply.github.com>"]
readme = "README.md"
Expand Down

0 comments on commit cee0ea0

Please sign in to comment.