Skip to content

Commit

Permalink
GptAgent is a GenServer
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilger committed Dec 15, 2023
1 parent 113640e commit cdd0373
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
17 changes: 7 additions & 10 deletions lib/gpt_agent.ex
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
defmodule GptAgent do
@moduledoc """
Documentation for `GptAgent`.
Provides a GPT conversation agent
"""

@doc """
Hello world.
use GenServer

## Examples
iex> GptAgent.hello()
:world
def init(init_arg) do
{:ok, init_arg}
end

"""
def hello do
:world
def start_link do
GenServer.start_link(__MODULE__, nil)
end
end
7 changes: 5 additions & 2 deletions test/gpt_agent_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ defmodule GptAgentTest do
use ExUnit.Case
doctest GptAgent

test "greets the world" do
assert GptAgent.hello() == :world
describe "start_link/0" do
test "starts the agent" do
assert {:ok, pid} = GptAgent.start_link()
assert Process.alive?(pid)
end
end
end

0 comments on commit cdd0373

Please sign in to comment.