-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
143 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,65 @@ | |
pip install convertanything | ||
``` | ||
|
||
## Usage | ||
## Usage Examples | ||
|
||
### ezLocalai | ||
|
||
To use with [ezLocalai](https://github.com/DevXT-LLC/ezlocalai) in Python, make sure your ezLocalai server is running then run the following code: | ||
|
||
```python | ||
from convertanything import convertanything | ||
from pydantic import BaseModel | ||
from typing import List | ||
|
||
|
||
class Person(BaseModel): | ||
name: str | ||
age: int | ||
email: str | ||
interests: List[str] | ||
|
||
|
||
response = convertanything( | ||
input_string="Hi my name is John Doe, I am 30 years old, my email is [email protected] . I like to go fishing and watching football.", | ||
model=Person, | ||
api_key="Your ezlocalai API Key", | ||
server="http://localhost:8091", | ||
) | ||
print(response) | ||
``` | ||
|
||
### AGiXT | ||
|
||
To use with [AGiXT](https://github.com/Josh-XT/AGiXT) in Python, make sure your AGiXT server is running then run the following code: | ||
|
||
```python | ||
from convertanything import convertanything | ||
from pydantic import BaseModel | ||
from typing import List | ||
|
||
|
||
class Person(BaseModel): | ||
name: str | ||
age: int | ||
email: str | ||
interests: List[str] | ||
|
||
|
||
response = convertanything( | ||
input_string="Hi my name is John Doe, I am 30 years old, my email is [email protected] . I like to go fishing and watching football.", | ||
model=Person, | ||
api_key="Your AGiXT API Key", | ||
server="http://localhost:7437", | ||
llm="Your AGiXT Agent Name", | ||
prompt_name="User Input", | ||
) | ||
print(response) | ||
``` | ||
|
||
### OpenAI | ||
|
||
If you have an OpenAI API key, you can use it as follows with OpenAI language models: | ||
|
||
```python | ||
from convertanything import convertanything | ||
|
@@ -25,6 +83,7 @@ response = convertanything( | |
input_string="Hi my name is John Doe, I am 30 years old, my email is [email protected] . I like to go fishing.", | ||
model=Person, | ||
api_key="Your OpenAI API Key", | ||
llm="gpt-3.5-turbo", | ||
) | ||
print(response) | ||
``` |
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 |
---|---|---|
|
@@ -15,6 +15,15 @@ | |
"Alternatively, to use with OpenAI API, you can remove the `server` and `llm` parameters and enter your OpenAI API key in the `api_key` parameter to use OpenAI API with the `gpt-3.5-turbo-16k` model or define which LLM you want to use with the `llm` parameter.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### ezLocalai\n", | ||
"\n", | ||
"To use with [ezLocalai](https://github.com/DevXT-LLC/ezlocalai) in Python, make sure your ezLocalai server is running then run the following code:\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
|
@@ -46,7 +55,80 @@ | |
" model=Person,\n", | ||
" api_key=\"Your ezlocalai API Key\",\n", | ||
" server=\"http://localhost:8091\",\n", | ||
" llm=\"ezlocalai\",\n", | ||
")\n", | ||
"print(response)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### AGiXT\n", | ||
"\n", | ||
"To use with [AGiXT](https://github.com/Josh-XT/AGiXT) in Python, make sure your AGiXT server is running then run the following code:\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from convertanything import convertanything\n", | ||
"from pydantic import BaseModel\n", | ||
"from typing import List\n", | ||
"\n", | ||
"\n", | ||
"class Person(BaseModel):\n", | ||
" name: str\n", | ||
" age: int\n", | ||
" email: str\n", | ||
" interests: List[str]\n", | ||
"\n", | ||
"\n", | ||
"response = convertanything(\n", | ||
" input_string=\"Hi my name is John Doe, I am 30 years old, my email is [email protected] . I like to go fishing and watching football.\",\n", | ||
" model=Person,\n", | ||
" api_key=\"Your AGiXT API Key\",\n", | ||
" server=\"http://localhost:7437\",\n", | ||
" llm=\"Your AGiXT Agent Name\",\n", | ||
" prompt_name=\"User Input\",\n", | ||
")\n", | ||
"print(response)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### OpenAI\n", | ||
"\n", | ||
"If you have an OpenAI API key, you can use it as follows with OpenAI language models:\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from convertanything import convertanything\n", | ||
"from pydantic import BaseModel\n", | ||
"from typing import List\n", | ||
"\n", | ||
"\n", | ||
"class Person(BaseModel):\n", | ||
" name: str\n", | ||
" age: int\n", | ||
" email: str\n", | ||
" interests: List[str]\n", | ||
"\n", | ||
"\n", | ||
"response = convertanything(\n", | ||
" input_string=\"Hi my name is John Doe, I am 30 years old, my email is [email protected] . I like to go fishing.\",\n", | ||
" model=Person,\n", | ||
" api_key=\"Your OpenAI API Key\",\n", | ||
" llm=\"gpt-3.5-turbo\",\n", | ||
")\n", | ||
"print(response)" | ||
] | ||
|