summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-18 20:18:51 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-18 20:18:51 +0200
commit7e543f4747914f280454f09b070ead500fb72277 (patch)
tree94e4680f009d25d2437895262e50316c2020b80e /examples
parentAdd missing styling on phone (diff)
downloadgpt4free-7e543f4747914f280454f09b070ead500fb72277.tar
gpt4free-7e543f4747914f280454f09b070ead500fb72277.tar.gz
gpt4free-7e543f4747914f280454f09b070ead500fb72277.tar.bz2
gpt4free-7e543f4747914f280454f09b070ead500fb72277.tar.lz
gpt4free-7e543f4747914f280454f09b070ead500fb72277.tar.xz
gpt4free-7e543f4747914f280454f09b070ead500fb72277.tar.zst
gpt4free-7e543f4747914f280454f09b070ead500fb72277.zip
Diffstat (limited to '')
-rw-r--r--examples/ecosia.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/ecosia.py b/examples/ecosia.py
new file mode 100644
index 00000000..5a2ae520
--- /dev/null
+++ b/examples/ecosia.py
@@ -0,0 +1,18 @@
+import asyncio
+import g4f
+from g4f.client import AsyncClient
+
+async def main():
+ client = AsyncClient(
+ provider=g4f.Provider.Ecosia,
+ )
+ async for chunk in client.chat.completions.create(
+ [{"role": "user", "content": "happy dogs on work. write some lines"}],
+ g4f.models.default,
+ stream=True,
+ green=True,
+ ):
+ print(chunk.choices[0].delta.content or "", end="")
+ print(f"\nwith {chunk.model}")
+
+asyncio.run(main()) \ No newline at end of file