Skip to content

Commit

Permalink
fix obscure
Browse files Browse the repository at this point in the history
  • Loading branch information
SermetPekin committed Aug 8, 2024
1 parent 8d2082d commit eb720f3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ build:
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

fail_on_warning : True

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ python3.11 -m pip install evdschat -U
python3.10 -m pip install evdschat -U
```

## Defining Api Keys ( .env file )

```bash
# .env file content

OPENAI_API_KEY = "sk-proj-ABCDEFGIJKLMNOPQRSTUXVZ"
EVDS_API_KEY=ABCDEFGIJKLMNOP

```

## Example

```python
Expand All @@ -56,21 +66,11 @@ prompt = '''
result, notes = chat(prompt, test=False)
print(result)
```
## Defining Api Keys ( .env file )

```bash
# .env file content

OPENAI_API_KEY = "sk-proj-ABCDEFGIJKLMNOPQRSTUXVZ"
EVDS_API_KEY=ABCDEFGIJKLMNOP

```



## New in this version
- Replaced some modern features to support earlier Python versions.
Now supports Python versions 3.9 through 3.12.



## License
Expand Down
5 changes: 5 additions & 0 deletions evdschat/core/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
class GotNoneFromGetter(BaseException): ...


class GotUndefinedResult(BaseException): ...


def chat(
prompt: str,
getter: ModelAbstract = OpenAI(),
Expand Down Expand Up @@ -65,6 +68,8 @@ def chat(
Please try again later or check documentation for
new API URLs"""
)
if not isinstance(res , tuple ) or len(res ) != 2 :
raise GotUndefinedResult()
result, notes = res
return result, notes

Expand Down
2 changes: 1 addition & 1 deletion evdschat/model/chatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def post(self, prompt: str) -> Union[dict, bool]:

def obscure(self, string: str) -> str:
nstr = []
for i, char in enumerate(string):
for i, char in enumerate(string.split()):
if i % 3 == 1:
nstr.append(char)
else:
Expand Down
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"""

# res , notes = chat(prompt, debug=True )
res = chat(prompt, debug=False )
print(res , type(res))
# res.to_excel('prompt1.xlsx')
res, notes = chat(prompt, debug=False)

print(res, type(res))
print(notes)
res.to_excel("prompt1.xlsx")

0 comments on commit eb720f3

Please sign in to comment.