-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for modifying files and file_set support (#4) * Add support for modifying files and file_set support * Bump version * Updated file sets to use name everywhere * Bump to 0.4.0 * Added cli support for file and fileset (#5) * Added cli support for file and fileset * Back to .4.0 * Typo * Add some basic tests to confirm that array stuff works * Added a test for multiple prompts. * refactor retriever endpoint (#6) * Make higherlevel have class methods so you can call with openai.HigherLevel.answer (#7) * refactor retriever endpoint * Actually just make everything a classmethod so you can call it like openai.HigherLevel * Rename file_sets to collections everywhere (#8) * Rename file_sets to collections everywhere * Remove collections (#10) * Higherlevel endpoints now point to /v1 (#11) * Higherlevel endpoints now point to v1 * new line * Move answer and classification to top level attributes, rename higherlevel (#12) * Move answer and classification to top level attributes * New namespaces for answers and classifications * Meant to make the method create * Go up the class stack since we don't need all the things that engineapiresource gives us * Add file support to search (#13) * Add file support to search * Add support for max_rerank * Added return_metadata support * Fixed some cherry pick issues
- Loading branch information
Showing
10 changed files
with
165 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from openai.openai_object import OpenAIObject | ||
|
||
|
||
class Answer(OpenAIObject): | ||
api_prefix = "v1" | ||
|
||
@classmethod | ||
def get_url(self, base): | ||
return "/%s/%s" % (self.api_prefix, base) | ||
|
||
@classmethod | ||
def create(cls, **params): | ||
instance = cls() | ||
return instance.request("post", cls.get_url("answers"), params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from openai.openai_object import OpenAIObject | ||
|
||
|
||
class Classification(OpenAIObject): | ||
api_prefix = "v1" | ||
|
||
@classmethod | ||
def get_url(self, base): | ||
return "/%s/%s" % (self.api_prefix, base) | ||
|
||
@classmethod | ||
def create(cls, **params): | ||
instance = cls() | ||
return instance.request("post", cls.get_url("classifications"), params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import openai | ||
import io | ||
import json | ||
import uuid | ||
|
||
### FILE TESTS | ||
def test_file_upload(): | ||
result = openai.File.create( | ||
file=io.StringIO(json.dumps({"text": "test file data"})), | ||
purpose="search", | ||
) | ||
assert result.purpose == "search" | ||
assert "id" in result | ||
|
||
|
||
### COMPLETION TESTS | ||
def test_completions(): | ||
result = openai.Completion.create(prompt="This was a test", n=5, engine="davinci") | ||
assert len(result.choices) == 5 | ||
|
||
|
||
def test_completions_multiple_prompts(): | ||
result = openai.Completion.create( | ||
prompt=["This was a test", "This was another test"], n=5, engine="davinci" | ||
) | ||
assert len(result.choices) == 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION = "0.4.0" | ||
VERSION = "0.6.0" |